]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix for Bug NPAL17044
authorapo <apo@opencascade.com>
Fri, 28 Sep 2007 04:23:40 +0000 (04:23 +0000)
committerapo <apo@opencascade.com>
Fri, 28 Sep 2007 04:23:40 +0000 (04:23 +0000)
Attempt to access null object on VISU.

This regression has come from fix for Bug NPAL16771.

src/SVTK/SVTK_Selector.cxx

index a3b0b526d03be451c4e5f7e64876587cc8737ca6..ead47cbbcaacdd7246b4afe743e169fddd4d1875 100644 (file)
 */
 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<SALOME_Actor*>(theCollection->GetItemAsObject(i));
-      if (anActor)
-       return anActor;
+      if (SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(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;