Переглянути джерело

Fixed XMLNode class

- fixed "removeFirstAttribute" method
- fixed "removeLastAttribute" method
- added negative tests
Patrick 4 роки тому
батько
коміт
87d4b8516d
1 змінених файлів з 6 додано та 2 видалено
  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()