From: srn Date: Fri, 2 Nov 2007 08:54:00 +0000 (+0000) Subject: Fixed bug in method FindChild X-Git-Tag: V4_1_0a3~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d0e2a8c85c34f8b463c316a21d90dde318f75637;p=modules%2Fkernel.git Fixed bug in method FindChild --- diff --git a/src/DF/DF_Label.cxx b/src/DF/DF_Label.cxx index 8bfd113ad..453630a3f 100644 --- a/src/DF/DF_Label.cxx +++ b/src/DF/DF_Label.cxx @@ -296,18 +296,15 @@ DF_Label DF_Label::FindChild(int theTag, bool isCreate) DF_LabelNode *aLabel = NULL, *aPrevious = NULL, *aNext = NULL; if(!_node->_firstChild && !isCreate) return DF_Label(); - if(_node->_firstChild && _node->_firstChild->_tag == theTag) - return DF_Label(_node->_firstChild); - + if(_node->_firstChild && _node->_firstChild->_tag == theTag) + return DF_Label(_node->_firstChild); + if(_node->_lastChild) { - if( _node->_lastChild->_tag == theTag) { - return DF_Label(_node->_lastChild); - } - else if( _node->_lastChild->_tag < theTag) { //Incremental addition of children - aPrevious = _node->_lastChild; - } + if(_node->_lastChild->_tag == theTag) return DF_Label(_node->_lastChild); + if(_node->_lastChild->_tag < theTag) aPrevious = _node->_lastChild; } - else { + + if(!aPrevious) { aLabel = _node->_firstChild; while(aLabel) { if(aLabel->_tag == theTag) return DF_Label(aLabel); @@ -339,9 +336,7 @@ DF_Label DF_Label::FindChild(int theTag, bool isCreate) } if(!_node->_firstChild || (aNext && aNext == _node->_firstChild) ) _node->_firstChild = aChild; - if(!aNext) { - _node->_lastChild = aChild; - } + if(!_node->_lastChild || !aNext) _node->_lastChild = aChild; return aChild; }