Index: applications/editors/josm/plugins/Create_grid_of_ways/src/CreateGridOfWaysPlugin/CreateGridOfWaysAction.java
===================================================================
--- applications/editors/josm/plugins/Create_grid_of_ways/src/CreateGridOfWaysPlugin/CreateGridOfWaysAction.java	(revision 34726)
+++ applications/editors/josm/plugins/Create_grid_of_ways/src/CreateGridOfWaysPlugin/CreateGridOfWaysAction.java	(revision 34727)
@@ -22,4 +22,5 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.MainApplication;
+import org.openstreetmap.josm.tools.Logging;
 import org.openstreetmap.josm.tools.Shortcut;
 
@@ -69,4 +70,8 @@
                     nodeCommon = n;
                 }
+        if (nodeCommon == null) {
+            Logging.error("Cannot find common node");
+            return;
+        }
         Way w2[] = new Way[nodesWay2.size()-1];
         for (int c=0;c<w2.length;c++)
@@ -78,7 +83,13 @@
         int c1=0,c2;
         double latDif,lonDif;
+        LatLon llc = nodeCommon.getCoor();
         for (Node n1 : nodesWay1) {
-            latDif = n1.getCoor().lat()-nodeCommon.getCoor().lat();
-            lonDif = n1.getCoor().lon()-nodeCommon.getCoor().lon();
+            LatLon ll1 = n1.getCoor();
+            if (ll1 == null || llc == null) {
+                Logging.warn("Null coordinates: {0} / {1}", n1, nodeCommon);
+                continue;
+            }
+            latDif = ll1.lat()-llc.lat();
+            lonDif = ll1.lon()-llc.lon();
             c2=0;
             for (Node n2 : nodesWay2) {
@@ -93,5 +104,6 @@
                     continue;
                 }
-                Node nodeOfGrid = new Node(new LatLon(n2.getCoor().lat()+latDif,n2.getCoor().lon()+lonDif));
+                LatLon ll2 = n2.getCoor();
+                Node nodeOfGrid = new Node(new LatLon(ll2.lat()+latDif, ll2.lon()+lonDif));
                 cmds.add(new AddCommand(ds, nodeOfGrid));
                 w1[c1].addNode(nodeOfGrid);
