Index: applications/editors/josm/plugins/terracer/build.xml
===================================================================
--- applications/editors/josm/plugins/terracer/build.xml	(revision 21350)
+++ applications/editors/josm/plugins/terracer/build.xml	(revision 21376)
@@ -32,5 +32,5 @@
 
 
-    <property name="commit.message" value="Fix the message text (and remove the now redundant message popup)" />
+    <property name="commit.message" value="Fix crash when adding a single address to an odd shaped building. See also #2496" />
     <property name="plugin.main.version" value="3210" />
 
Index: applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java
===================================================================
--- applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java	(revision 21350)
+++ applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java	(revision 21376)
@@ -203,10 +203,4 @@
                             + " from " + from + " to " + to + " step " + step);
         }
-		
-        // now find which is the longest side connecting the first node
-        Pair<Way, Way> interp = findFrontAndBack(outline);
-
-        final double frontLength = wayLength(interp.a);
-        final double backLength = wayLength(interp.b);
 
         // new nodes array to hold all intermediate nodes
@@ -216,6 +210,14 @@
         Collection<Way> ways = new LinkedList<Way>();
 
+		// Should this building be terraced (i.e. is there more then one section?)
 		if (nb > 1) {
 		    // create intermediate nodes by interpolating.
+		    
+		    // now find which is the longest side connecting the first node
+			Pair<Way, Way> interp = findFrontAndBack(outline);
+
+			final double frontLength = wayLength(interp.a);
+			final double backLength = wayLength(interp.b);
+			
 		    for (int i = 0; i <= nb; ++i) {
 		        new_nodes[0][i] = interpolateAlong(interp.a, frontLength * i / nb);
@@ -254,5 +256,5 @@
 		    }
 		} else {
-			// Single building, just add the address details
+			// Single section, just add the address details
 			Way newOutline;
 			newOutline = addressBuilding(outline, street, streetName, From);
