svn commit: r16169 - trunk/src/argouml-app/src/org/argouml/ui/cmd/ActionAdjustGrid.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-11-24 00:40:41-0800
New Revision: 16169

Modified:
   trunk/src/argouml-app/src/org/argouml/ui/cmd/ActionAdjustGrid.java

Log:
Protect against NullPointerException

Modified: trunk/src/argouml-app/src/org/argouml/ui/cmd/ActionAdjustGrid.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/ui/cmd/ActionAdjustGrid.java?view=diff&rev=16169&p1=trunk/src/argouml-app/src/org/argouml/ui/cmd/ActionAdjustGrid.java&p2=trunk/src/argouml-app/src/org/argouml/ui/cmd/ActionAdjustGrid.java&r1=16168&r2=16169
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/ui/cmd/ActionAdjustGrid.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/ui/cmd/ActionAdjustGrid.java	2008-11-24 00:40:41-0800
@@ -76,17 +76,21 @@
 
     public void actionPerformed(final ActionEvent e) {
         final Editor editor = Globals.curEditor();
-        final Layer grid = editor.getLayerManager().findLayerNamed("Grid");
-        if (grid instanceof LayerGrid) {
-            if (myMap != null) {
-                // Kludge required by GEF's use of HashMap in the API
-                // TODO: This can be removed if they ever fix GEF to use Maps
-                if (myMap instanceof HashMap) {
-                    grid.adjust((HashMap<String, Comparable>) myMap);
-                } else {
-                    grid.adjust(new HashMap<String, Comparable>(myMap));
+        if (editor != null) {
+            final Layer grid = editor.getLayerManager().findLayerNamed("Grid");
+            if (grid instanceof LayerGrid) {
+                if (myMap != null) {
+                    // Kludge required by GEF's use of HashMap in the API
+                    // TODO: This can be removed if they ever fix GEF to use
+                    // Maps
+                    if (myMap instanceof HashMap) {
+                        grid.adjust((HashMap<String, Comparable>) myMap);
+                    } else {
+                        grid.adjust(new HashMap<String, Comparable>(myMap));
+                    }
+                    Configuration.setString(Argo.KEY_GRID,
+                            (String) getValue("ID"));
                 }
-                Configuration.setString(Argo.KEY_GRID, (String) getValue("ID"));
             }
         }
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.