Index: /trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 6541)
+++ /trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 6542)
@@ -179,14 +179,12 @@
 
         // update selection to reflect which way being modified
-        if (currentBaseNode != null && getCurrentDataSet() != null && !getCurrentDataSet().getSelected().isEmpty()) {
+        DataSet currentDataSet = getCurrentDataSet();
+        if (currentBaseNode != null && currentDataSet != null && !currentDataSet.getSelected().isEmpty()) {
             Way continueFrom = getWayForNode(currentBaseNode);
             if (alt && continueFrom != null && (!currentBaseNode.isSelected() || continueFrom.isSelected())) {
-                getCurrentDataSet().beginUpdate(); // to prevent the selection listener to screw around with the state
-                getCurrentDataSet().addSelected(currentBaseNode);
-                getCurrentDataSet().clearSelection(continueFrom);
-                getCurrentDataSet().endUpdate();
+                addRemoveSelection(currentDataSet, currentBaseNode, continueFrom);
                 needsRepaint = true;
             } else if (!alt && continueFrom != null && !continueFrom.isSelected()) {
-                getCurrentDataSet().addSelected(continueFrom);
+                addRemoveSelection(currentDataSet, continueFrom, currentBaseNode);
                 needsRepaint = true;
             }
@@ -197,4 +195,11 @@
         }
         return needsRepaint;
+    }
+
+    private static void addRemoveSelection(DataSet ds, OsmPrimitive toAdd, OsmPrimitive toRemove) {
+        ds.beginUpdate(); // to prevent the selection listener to screw around with the state
+        ds.addSelected(toAdd);
+        ds.clearSelection(toRemove);
+        ds.endUpdate();
     }
 
