From: apo Date: Fri, 28 Sep 2007 04:19:15 +0000 (+0000) Subject: Fix for Bug NPAL17044 X-Git-Tag: V4_1_0a1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a13163e1590e1a8bc3f90d5582d56a022edd6425;p=modules%2Fgui.git Fix for Bug NPAL17044 Attempt to access null object on VISU. This regression has come from fix for Bug NPAL16771. --- diff --git a/src/SVTK/SVTK_Selector.cxx b/src/SVTK/SVTK_Selector.cxx index db6474a2a..fe5a93047 100644 --- a/src/SVTK/SVTK_Selector.cxx +++ b/src/SVTK/SVTK_Selector.cxx @@ -44,13 +44,13 @@ */ inline SALOME_Actor* -GetFirstSALOMEActor(vtkActorCollection* theCollection) +GetLastSALOMEActor(vtkActorCollection* theCollection) { if (theCollection) { for (int i = theCollection->GetNumberOfItems() - 1; i >= 0; i--) { - SALOME_Actor* anActor = dynamic_cast(theCollection->GetItemAsObject(i)); - if (anActor) - return anActor; + if (SALOME_Actor* anActor = dynamic_cast(theCollection->GetItemAsObject(i))) + if (anActor->hasIO()) + return anActor; } } return NULL; @@ -551,7 +551,7 @@ SVTK_SelectorDef theRenderer); vtkActorCollection* aListActors = myCellPicker->GetActors(); - SALOME_Actor* anActor = GetFirstSALOMEActor(aListActors); + SALOME_Actor* anActor = GetLastSALOMEActor(aListActors); if (! anActor) { myPicker->Pick(theEvent->myX, @@ -559,7 +559,7 @@ SVTK_SelectorDef 0.0, theRenderer); aListActors = myPicker->GetActors(); - anActor = GetFirstSALOMEActor(aListActors); + anActor = GetLastSALOMEActor(aListActors); } return anActor;