Fixed issue 2945 (#2946)

* Fixed #2945

* Added unit tests for #2945

* Dissalow iterator on empty Var (#2945)

* Updated unit tests for #2945

* More concise unit tests for #2945

* Removed some more clutter (#2945)
This commit is contained in:
akete
2020-03-03 20:47:53 +01:00
committed by GitHub
parent 7ca90cb0c3
commit 1d16cb115b
4 changed files with 31 additions and 8 deletions

View File

@@ -737,7 +737,7 @@ inline const std::type_info& Var::type() const
inline Var::ConstIterator Var::begin() const
{
if (isEmpty()) return ConstIterator(const_cast<Var*>(this), true);
if (size() == 0) return ConstIterator(const_cast<Var*>(this), true);
return ConstIterator(const_cast<Var*>(this), false);
}
@@ -749,7 +749,7 @@ inline Var::ConstIterator Var::end() const
inline Var::Iterator Var::begin()
{
if (isEmpty()) return Iterator(const_cast<Var*>(this), true);
if (size() == 0) return Iterator(const_cast<Var*>(this), true);
return Iterator(const_cast<Var*>(this), false);
}