]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram/src/org/simantics/diagram/elements/EditorStateManager.java
Robustness fixes for inline SVG text editing on diagrams
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / elements / EditorStateManager.java
index 8ddb16ac76d53eec771f7c165a64f3b6a00fc7e9..5c59177cccf4f1c3a8088ff08690adf79c5c7ac7 100644 (file)
@@ -67,6 +67,9 @@ class EditorStateManager {
                String currentText = span.getText();
 
                SingleElementNode sne = node.getSingleElementNode();
+               if (sne == null)
+                       return;
+
                Function1<String,String> fullTextFunction = sne.getParameter("textEditorFullText"); 
                if(fullTextFunction != null)
                        es.currentText = fullTextFunction.apply(es.base.textElementId);
@@ -114,10 +117,12 @@ class EditorStateManager {
 
        void applyEdit() {
                SingleElementNode sne = node.getSingleElementNode();
-               EditorState es = currentState();
-               Function2<String,String,Object> editor = sne.getParameter("textEditor");
-               if(editor != null) {
-                       editor.apply(es.base.textElementId, es.currentText);
+               if (sne != null) {
+                       EditorState es = currentState();
+                       Function2<String,String,Object> editor = sne.getParameter("textEditor");
+                       if(editor != null) {
+                               editor.apply(es.base.textElementId, es.currentText);
+                       }
                }
        }