From b410091aa9e34d36190d4649cd6741fcff8f15c4 Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 28 Sep 2007 04:23:40 +0000 Subject: [PATCH] Fix for Bug NPAL17044 Attempt to access null object on VISU. This regression has come from fix for Bug NPAL16771. --- src/SVTK/SVTK_Selector.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/SVTK/SVTK_Selector.cxx b/src/SVTK/SVTK_Selector.cxx index a3b0b526d..ead47cbbc 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; @@ -554,7 +554,7 @@ SVTK_SelectorDef theRenderer); vtkActorCollection* aListActors = myCellPicker->GetActors(); - SALOME_Actor* anActor = GetFirstSALOMEActor(aListActors); + SALOME_Actor* anActor = GetLastSALOMEActor(aListActors); if (! anActor) { myPicker->Pick(theEvent->myX, @@ -562,7 +562,7 @@ SVTK_SelectorDef 0.0, theRenderer); aListActors = myPicker->GetActors(); - anActor = GetFirstSALOMEActor(aListActors); + anActor = GetLastSALOMEActor(aListActors); } return anActor; -- 2.39.2