Fix NPE on units conversion. 46/15946/1
Bruno JOFRET [Wed, 11 Feb 2015 16:02:17 +0000 (17:02 +0100)]
Change-Id: Ica368930b821cd6f879949973bd0350b119a2e1f

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

index f98bde0..f08c75d 100644 (file)
@@ -141,6 +141,9 @@ public final class UnitsConverter {
     }
 
     public static double convertFromPixel(int value, UicontrolUnits newUnit, Widget uicontrol, boolean widthAsRef) {
+        if (uicontrol == null) {
+            return (double) value;
+        }
 
         SwingViewObject uicontrolAsView = (SwingViewObject) uicontrol;
         int widgetType = (Integer) GraphicController.getController().getProperty(uicontrolAsView.getId(), __GO_TYPE__);