From 87bcbaa73e511d83663a38b67312f6f1aa68bed2 Mon Sep 17 00:00:00 2001 From: srn Date: Wed, 13 Dec 2006 11:51:10 +0000 Subject: [PATCH] Fixed bug in method GetUseCaseIterator, now there is no crash when an Iterator is requested for Null SObject --- src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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); } -- 2.39.2