From a13163e1590e1a8bc3f90d5582d56a022edd6425 Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 28 Sep 2007 04:19:15 +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 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; -- 2.39.2