CoverityFix-CID:1350465 Dereference null return value 52/20452/3
Nimish Kapoor [Sun, 5 Aug 2018 18:59:11 +0000 (23:59 +0530)]
Change-Id: Ie40b6f21a3b93c8a1c19e88d4976be46763ed904

scilab/modules/gui/src/java/org/scilab/modules/gui/utils/WindowsConfigurationManager.java

index 83e4ef5..7e00718 100644 (file)
@@ -427,10 +427,12 @@ public class WindowsConfigurationManager implements XConfigurationListener {
             if (gds != null) {
                 for (GraphicsDevice gd : gds) {
                     Rectangle r = gd.getDefaultConfiguration().getBounds();
-                    if (r.contains(p)) {
-                        positionned = true;
-                        window.setLocation(p.x, p.y);
-                        break;
+                    if (r != null) {
+                        if (r.contains(p)) {
+                            positionned = true;
+                            window.setLocation(p.x, p.y);
+                            break;
+                        }
                     }
                 }
             }
@@ -441,7 +443,7 @@ public class WindowsConfigurationManager implements XConfigurationListener {
         }
 
         window.setSize(((Integer) attrs.get("width")).intValue(), ((Integer) attrs.get("height")).intValue());
-        
+
         /* remove ICONIFIED at restoration */
         int state = ((Integer)attrs.get("state")).intValue();
         if((state & SwingScilabWindow.ICONIFIED) == SwingScilabWindow.ICONIFIED) {