From: srn Date: Wed, 13 Dec 2006 11:51:10 +0000 (+0000) Subject: Fixed bug in method GetUseCaseIterator, now there is no crash when an Iterator is... X-Git-Tag: SALOMEDS_UnitTests_1_2~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=87bcbaa73e511d83663a38b67312f6f1aa68bed2;p=modules%2Fkernel.git Fixed bug in method GetUseCaseIterator, now there is no crash when an Iterator is requested for Null SObject --- diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx index d429516f3..c89cb6ff3 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx @@ -200,11 +200,19 @@ _PTR(SObject) SALOMEDS_UseCaseBuilder::AddUseCase(const std::string& theName) _PTR(UseCaseIterator) SALOMEDS_UseCaseBuilder::GetUseCaseIterator(const _PTR(SObject)& theObject) { SALOMEDS_UseCaseIterator* it = NULL; - SALOMEDS_SObject* obj = dynamic_cast(theObject.get()); + SALOMEDS_SObject* obj = (theObject)?dynamic_cast(theObject.get()):NULL; if (_isLocal) { SALOMEDS::Locker lock; - it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(obj->GetLocalImpl())); + if(obj) + it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(obj->GetLocalImpl())); + else + it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(NULL)); + } + else { + if(obj) + it = new SALOMEDS_UseCaseIterator(_corba_impl->GetUseCaseIterator(obj->GetCORBAImpl())); + else + it = new SALOMEDS_UseCaseIterator(_corba_impl->GetUseCaseIterator(SALOMEDS::SObject::_nil())); } - else it = new SALOMEDS_UseCaseIterator(_corba_impl->GetUseCaseIterator(obj->GetCORBAImpl())); return _PTR(UseCaseIterator)(it); }