Graphic: Avoid crash with auto_clear set to 'on' 03/13103/2
Calixte DENIZET [Thu, 7 Nov 2013 16:23:04 +0000 (17:23 +0100)]
Change-Id: Ie6b81c2b2ab97dc05ed601e3dd39090559eca31f

scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicController/GraphicController.java

index 149b5be..ff6e49d 100644 (file)
@@ -344,7 +344,10 @@ public class GraphicController {
 
         /* Insertion occurs at the head of the children list. */
         if (parentId != null && parentId != 0) {
-            getObjectFromId(parentId).addChild(childId);
+            GraphicObject go = getObjectFromId(parentId);
+            if (go != null) {
+                go.addChild(childId);
+            }
         }
 
         setProperty(childId, GraphicObjectProperties.__GO_PARENT__, parentId);