Parcourir la source

Fixed XMLNode class

- fixed "removeFirstAttribute" method
- fixed "removeLastAttribute" method
- added negative tests
Patrick il y a 4 ans
Parent
commit
87d4b8516d
1 fichiers modifiés avec 6 ajouts et 2 suppressions
  1. 6 2
      source/io/xml/XMLNode.cpp

+ 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()