diff options
Diffstat (limited to 'xml2cmp')
-rw-r--r-- | xml2cmp/source/support/list.hxx | 5 | ||||
-rw-r--r-- | xml2cmp/source/xcd/xmlelem.cxx | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/xml2cmp/source/support/list.hxx b/xml2cmp/source/support/list.hxx index cf949a070e2a..7b270d997853 100644 --- a/xml2cmp/source/support/list.hxx +++ b/xml2cmp/source/support/list.hxx @@ -73,6 +73,9 @@ class List unsigned size() const { return len; } unsigned space() const { return allocated; } + bool is_valid_index( + unsigned n) const + { return n < len; } // ACCESS XX & front() { return elem(0); } XX & back() { return elem(len-1); } @@ -236,7 +239,7 @@ template <class XY> void DynamicList<XY>::remove( unsigned pos ) { - if (pos >= this->len) + if (!this->is_valid_index(pos) ) return; this->len--; delete this->inhalt[pos]; diff --git a/xml2cmp/source/xcd/xmlelem.cxx b/xml2cmp/source/xcd/xmlelem.cxx index 5a795d61c8aa..836c8f65179e 100644 --- a/xml2cmp/source/xcd/xmlelem.cxx +++ b/xml2cmp/source/xcd/xmlelem.cxx @@ -202,7 +202,7 @@ MultipleTextElement::Data( unsigned i_nNr ) const { static const Simstr sNull_; - if (i_nNr < aContent.size()) + if (aContent.is_valid_index(i_nNr)) return aContent[i_nNr]; return sNull_; } |