소스 검색

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