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 / OpenURLAction.java
index 9dc33f5..076a946 100644 (file)
@@ -66,11 +66,13 @@ public class OpenURLAction extends DefaultAction {
     public static MenuItem createMenu(String label, final SciNotes editor, KeyStroke key) {
         final MenuItem menuitem = createMenu(label, null, new OpenURLAction(label, editor), key);
         ((JMenuItem) menuitem.getAsSimpleMenuItem()).addPropertyChangeListener(new PropertyChangeListener() {
-                public void propertyChange(PropertyChangeEvent arg0) {
-                    String keyword = editor.getTextPane().getSelectedText();
-                    if (keyword == null) {
-                        KeywordEvent kwe = editor.getTextPane().getKeywordEvent();
-                        menuitem.setEnabled(ScilabLexerConstants.MAIL == kwe.getType() || ScilabLexerConstants.URL == kwe.getType());
+                public void propertyChange(PropertyChangeEvent e) {
+                    if (editor.getTextPane() != null) {
+                        String keyword = editor.getTextPane().getSelectedText();
+                        if (keyword == null) {
+                            KeywordEvent kwe = editor.getTextPane().getKeywordEvent();
+                            menuitem.setEnabled(ScilabLexerConstants.MAIL == kwe.getType() || ScilabLexerConstants.URL == kwe.getType());
+                        }
                     }
                 }
             });