]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Check for null values in property manipulators 56/3456/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Wed, 6 Nov 2019 10:49:33 +0000 (12:49 +0200)
committerReino Ruusu <reino.ruusu@semantum.fi>
Wed, 6 Nov 2019 12:59:19 +0000 (14:59 +0200)
Change-Id: Id075b3cdce3483c14257e0949ed898670c82b42e

org.simantics.g3d/src/org/simantics/g3d/property/BooleanPropertyManipulator.java
org.simantics.g3d/src/org/simantics/g3d/property/DoubleArrayPropertyManipulator.java
org.simantics.g3d/src/org/simantics/g3d/property/DoubleArrayPropertyManipulator2.java
org.simantics.g3d/src/org/simantics/g3d/property/DoublePropertyManipulator.java
org.simantics.g3d/src/org/simantics/g3d/property/IntegerPropertyManipulator.java

index a4534a4741debdd444468bd55710d530da953c08..7d9b65b6e48dc1d578d66c78d34fea65ab534183 100644 (file)
@@ -42,7 +42,9 @@ public class BooleanPropertyManipulator implements PropertyManipulator {
                if (editMode)\r
                        return editValue;\r
                try {\r
-                       return provider.getValue(input).toString();\r
+                       Object value = provider.getValue(input);\r
+                       if (value == null) return null;\r
+                       return value.toString();\r
                } catch (Exception e) {\r
                        return null;\r
                }\r
index bfaa4a506a3c833a605b330eb203b0d2a3c5e04e..a9971605af500f1433678bc20701f4b232c76734 100644 (file)
@@ -51,6 +51,7 @@ public class DoubleArrayPropertyManipulator implements PropertyManipulator {
                }
                try {
                    double[] val = getValue();
+                       if (val == null) return null;
                    return Arrays.toString(val);
                } catch (Exception e) {
                        return null;
index 82e9a0622b56be02123b27d33889f85af2968236..6b7a2e115dbe833632888cc85024a4a2edd22ee0 100644 (file)
@@ -51,6 +51,8 @@ public class DoubleArrayPropertyManipulator2 implements PropertyManipulator {
                }
                try {
                    double[] val = getValue();
+                   if (val == null)
+                       return null;
                    if (val.length == i)
                        return "New";
             if (val.length < i)
index 47f6ca7d21fb93066971e9982c93485bad242573..4f7c670fc71ab186e722c31ff72adc0bab35ca71 100644 (file)
@@ -41,7 +41,9 @@ public class DoublePropertyManipulator implements PropertyManipulator {
                if (editMode)
                        return editValue;
                try {
-                       return provider.getValue(input).toString();
+                       Object value = provider.getValue(input);
+                       if (value == null) return null;
+                       return value.toString();
                } catch (Exception e) {
                        return null;
                }
index d0f5e1d6b4b4f645ad2295d740cfcf5cf267b48f..045aa83072cdc6ed4bdb9879e5321fd8a143bafd 100644 (file)
@@ -42,7 +42,9 @@ public class IntegerPropertyManipulator implements PropertyManipulator {
                if (editMode)\r
                        return editValue;\r
                try {\r
-                       return provider.getValue(input).toString();\r
+                       Object value = provider.getValue(input);\r
+                       if (value == null) return null;\r
+                       return value.toString();\r
                } catch (Exception e) {\r
                        return null;\r
                }\r