diff options
author | Kevin Smith <git@kismith.co.uk> | 2012-01-10 13:54:31 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-01-10 13:54:31 (GMT) |
commit | 0f1163c722a39783b07ca6d4027010cb310e7b36 (patch) | |
tree | f1c282eceb026268494485eab94b86430ac91067 | |
parent | f504079157860a09ba222ea38f1bd799bdb8a1f7 (diff) | |
download | swift-contrib-0f1163c722a39783b07ca6d4027010cb310e7b36.zip swift-contrib-0f1163c722a39783b07ca6d4027010cb310e7b36.tar.bz2 |
Don't allow null form fields
-rw-r--r-- | Swiften/Elements/Form.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Swiften/Elements/Form.h b/Swiften/Elements/Form.h index 47ff7d4..0d1ed63 100644 --- a/Swiften/Elements/Form.h +++ b/Swiften/Elements/Form.h @@ -28,7 +28,10 @@ namespace Swift { public: Form(Type type = FormType) : type_(type) {} - void addField(boost::shared_ptr<FormField> field) { fields_.push_back(field); } + /** Add a field to the form. + * @param field New field - must not be null. + */ + void addField(boost::shared_ptr<FormField> field) {assert(field); fields_.push_back(field); } const std::vector<boost::shared_ptr<FormField> >& getFields() const { return fields_; } void setTitle(const std::string& title) { title_ = title; } const std::string& getTitle() const { return title_; } |