Index: trunk/src/org/openstreetmap/josm/actions/mapmode/AddNodeAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/AddNodeAction.java	(revision 355)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/AddNodeAction.java	(revision 356)
@@ -219,10 +219,11 @@
 	 * 	<code>null</code> otherwise.
 	 */
-	private Way getWayForNode(Node n) {
+	public static Way getWayForNode(Node n) {
 		Way way = null;
 		for (Way w : Main.ds.ways) {
 			if (w.nodes.size() < 1) continue;
-			int i = w.nodes.indexOf(n);
-			if (w.nodes.get(0) == n || w.nodes.get(w.nodes.size() - 1) == n) {
+			Node firstNode = w.nodes.get(0);
+			Node lastNode = w.nodes.get(w.nodes.size() - 1);
+			if ((firstNode == n || lastNode == n) && (firstNode != lastNode)) {
 				if (way != null)
 					return null;
Index: trunk/src/org/openstreetmap/josm/actions/mapmode/AddSegmentAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/AddSegmentAction.java	(revision 355)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/AddSegmentAction.java	(revision 356)
@@ -123,22 +123,4 @@
 
 	/**
-	 * @return If the node is the end of exactly one way, return this. 
-	 * 	<code>null</code> otherwise.
-	 */
-	private Way getWayForNode(Node n) {
-		Way way = null;
-		for (Way w : Main.ds.ways) {
-			int i = w.nodes.indexOf(n);
-			if (i == -1) continue;
-			if (i == 0 || i == w.nodes.size() - 1) {
-				if (way != null)
-					return null;
-				way = w;
-			}
-		}
-		return way;
-	}
-
-	/**
 	 * Create the segment if first and second are different and there is
 	 * not already a segment.
@@ -155,5 +137,5 @@
 		if (n1 == null || n2 == null || n1 == n2) return;
 
-		Way w = getWayForNode(n1);
+		Way w = AddNodeAction.getWayForNode(n1);
 		Way wnew;
 		Collection<OsmPrimitive> sel = Main.ds.getSelected();
