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

This regression has come from fix for Bug NPAL16771.

src/SVTK/SVTK_Selector.cxx

index db6474a2a1fb9f9b612cbee23a1135d075cf1e5c..fe5a930470c1bbf2c9585722dacbe98c23e1624a 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;
@@ -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;