Bug 8135 fixed: An exception was thrown when restoring files on MacOS X
[scilab.git] / scilab / modules / scinotes / src / java / org / scilab / modules / scinotes / actions / CopySelectionInNewTabAction.java
index 39e00d1..5154925 100644 (file)
@@ -59,8 +59,10 @@ public final class CopySelectionInNewTabAction extends DefaultAction {
         final MenuItem menuitem = createMenu(label, null, new CopySelectionInNewTabAction(label, editor), key);
         ((JMenuItem) menuitem.getAsSimpleMenuItem()).addPropertyChangeListener(new PropertyChangeListener() {
                 public void propertyChange(PropertyChangeEvent e) {
-                    String selection = editor.getTextPane().getSelectedText();
-                    menuitem.setEnabled(selection != null);
+                    if (editor.getTextPane() != null) {
+                        String selection = editor.getTextPane().getSelectedText();
+                        menuitem.setEnabled(selection != null);
+                    }
                 }
             });