Эх сурвалжийг харах

Fixed XMLNode class

- fixed "removeFirstAttribute" method
- fixed "removeLastAttribute" method
- added negative tests
Patrick 4 жил өмнө
parent
commit
87d4b8516d

+ 6 - 2
source/io/xml/XMLNode.cpp

@@ -187,12 +187,16 @@ bool ls_std::XMLNode::hasChild(const std::shared_ptr<XMLNode> &_child)
 
 void ls_std::XMLNode::removeFirstAttribute()
 {
-  this->attributes.pop_front();
+  if(!this->attributes.empty()) {
+    this->attributes.pop_front();
+  }
 }
 
 void ls_std::XMLNode::removeLastAttribute()
 {
-  this->attributes.pop_back();
+  if(!this->attributes.empty()) {
+    this->attributes.pop_back();
+  }
 }
 
 void ls_std::XMLNode::removeFirstChild()