Salome HOME
#refs 327 - Polyline is not shown during creation
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Operation.cxx
index 5fe0773011920a6249b00a52e8eb911453bc1ebb..de64a1878949e6d968c2e113e507a4ecb668d272 100644 (file)
@@ -182,20 +182,21 @@ void HYDROGUI_Operation::stopOperation()
 
   // pop the operation from the cached map of active operations
   QStack<HYDROGUI_Operation*>& anOperations = myModule->getActiveOperations();
-  if ( anOperations.top() == this )
-  {
-    anOperations.pop();
-  }
-  else {
-    // find in the stack the current operation and remove it from the stack
-    QVectorIterator<HYDROGUI_Operation*> aVIt( anOperations );
-    aVIt.toBack();
-    aVIt.previous(); // skip the top show/hide operation
-    while ( aVIt.hasPrevious() )
+  if ( !anOperations.empty() ) {
+    if ( anOperations.top() == this )
+      anOperations.pop();
+    else
     {
-      HYDROGUI_Operation* anOp = aVIt.previous();
-      if ( anOp == this )
-        anOperations.remove( anOperations.lastIndexOf( anOp ) );
+      // find in the stack the current operation and remove it from the stack
+      QVectorIterator<HYDROGUI_Operation*> aVIt( anOperations );
+      aVIt.toBack();
+      aVIt.previous(); // skip the top show/hide operation
+      while ( aVIt.hasPrevious() )
+      {
+        HYDROGUI_Operation* anOp = aVIt.previous();
+        if ( anOp == this )
+          anOperations.remove( anOperations.lastIndexOf( anOp ) );
+      }
     }
   }
   // release the preview manager with removing the added preview Z layer