From: mzn Date: Wed, 20 Nov 2013 14:06:09 +0000 (+0000) Subject: Add SObject check. X-Git-Tag: BR_hydro_v_0_3_1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f5c8555cd0ac80531077f56a98315bf98cc28adf;p=modules%2Fgeom.git Add SObject check. --- diff --git a/src/GEOMGUI/GEOMGUI_Selection.cxx b/src/GEOMGUI/GEOMGUI_Selection.cxx index c7b82dfd0..d1bdf3767 100644 --- a/src/GEOMGUI/GEOMGUI_Selection.cxx +++ b/src/GEOMGUI/GEOMGUI_Selection.cxx @@ -413,8 +413,10 @@ bool GEOMGUI_Selection::isVectorsMode( const int index ) const bool GEOMGUI_Selection::hasChildren( const _PTR(SObject)& obj ) { - // as soon as Use Case browser data tree was added - return obj->GetStudy()->GetUseCaseBuilder()->HasChildren( obj ); + if ( obj ) { + // as soon as Use Case browser data tree was added + return obj->GetStudy()->GetUseCaseBuilder()->HasChildren( obj ); + } } bool GEOMGUI_Selection::expandable( const _PTR(SObject)& obj ) @@ -443,7 +445,7 @@ bool GEOMGUI_Selection::isFolder( const _PTR(SObject)& obj ) { bool ret = false; _PTR(GenericAttribute) anAttr; - if ( obj->FindAttribute(anAttr, "AttributeLocalID") ) { + if ( obj && obj->FindAttribute(anAttr, "AttributeLocalID") ) { _PTR(AttributeLocalID) aLocalID( anAttr ); ret = aLocalID->Value() == 999; } @@ -476,7 +478,7 @@ int GEOMGUI_Selection::nbChildren( const int index ) const _PTR(Study) study = appStudy->studyDS(); if ( study && !anEntry.isEmpty() ) { _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) ); - if ( aSO->GetStudy()->GetUseCaseBuilder()->IsUseCaseNode(aSO) ) { + if ( aSO && aSO->GetStudy()->GetUseCaseBuilder()->IsUseCaseNode(aSO) ) { _PTR(UseCaseIterator) it = aSO->GetStudy()->GetUseCaseBuilder()->GetUseCaseIterator( aSO ); for (it->Init(false); it->More(); it->Next()) nb++; }