]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx
Clean Code
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / WidgetShowNPoints.cxx
index ae720aea010c5fc686a5df12bc14f48688082c30..aaff102c03e55a5c7ad55d96da8d3f395a26adfa 100644 (file)
@@ -1388,7 +1388,6 @@ void WidgetShowNPoints::OnInsertCollectionAfter(wxCommandEvent &event)
 //------------------------------------------------------------------------
 void WidgetShowNPoints::CreatePointsIntoNewCollection()
 {
-    //   ---------------------------------------------
     int c1          = mActualCollection-1;
     int c2          = mActualCollection+1;
     int modelSize   = lstModelShowNPoints.size();
@@ -1460,8 +1459,8 @@ void WidgetShowNPoints::CreatePointsIntoNewCollection()
             } // for
             delete m;
             // ----------------- Add new Points --------------------
-            vtkPoints               *points;
-            vtkStaticPointLocator   *pointLocator;
+            vtkPoints               *points         = NULL;
+            vtkStaticPointLocator   *pointLocator   = NULL;
             if (aux_mesh!=NULL)
             {
                 points         = aux_mesh->GetPoints();
@@ -1490,7 +1489,7 @@ void WidgetShowNPoints::CreatePointsIntoNewCollection()
                 } // aux_mesh
                 AddPoint(x,y,z,"");
             }
-            pointLocator->Delete();
+            if (pointLocator!=NULL) { pointLocator->Delete(); }
             RefreshCollectionText();
             RefreshColourCollection();
         } // if size of c1LstX c2LstX