Index: trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java	(revision 11480)
+++ trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java	(revision 11481)
@@ -111,5 +111,6 @@
             return candidates.get(size - 1);
         case 1:
-            double east1 = 0, north1 = 0;
+            double east1 = 0;
+            double north1 = 0;
             for (final Node n : candidates) {
                 EastNorth en = n.getEastNorth();
@@ -132,5 +133,7 @@
             }
 
-            double east2 = 0, north2 = 0, weight = 0;
+            double east2 = 0;
+            double north2 = 0;
+            double weight = 0;
             for (int i = 0; i < size; i++) {
                 final EastNorth en = candidates.get(i).getEastNorth();
@@ -140,4 +143,7 @@
                 weight += w;
             }
+
+            if (weight == 0) // to avoid division by 0
+                return candidates.get(0);
 
             return new Node(new EastNorth(east2 / weight, north2 / weight));
