Index: trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java	(revision 10114)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java	(revision 10115)
@@ -763,6 +763,4 @@
         }
         return bestMovement;
-
-
     }
 
@@ -1026,5 +1024,5 @@
                 Point p4 = mv.getPoint(newN2en);
 
-                Point2D normalUnitVector = getNormalUniVector();
+                Point2D normalUnitVector = activeMoveDirection != null ? getNormalUniVector() : null;
 
                 if (mode == Mode.extrude || mode == Mode.create_new) {
@@ -1033,6 +1031,8 @@
                     // Draw rectangle around new area.
                     GeneralPath b = new GeneralPath();
-                    b.moveTo(p1.x, p1.y); b.lineTo(p3.x, p3.y);
-                    b.lineTo(p4.x, p4.y); b.lineTo(p2.x, p2.y);
+                    b.moveTo(p1.x, p1.y);
+                    b.lineTo(p3.x, p3.y);
+                    b.lineTo(p4.x, p4.y);
+                    b.lineTo(p2.x, p2.y);
                     b.lineTo(p1.x, p1.y);
                     g2.draw(b);
@@ -1042,5 +1042,5 @@
                         drawReferenceSegment(g2, mv, dualAlignSegment1);
                         drawReferenceSegment(g2, mv, dualAlignSegment2);
-                    } else if (activeMoveDirection != null) {
+                    } else if (activeMoveDirection != null && normalUnitVector != null) {
                         // Draw reference way
                         drawReferenceSegment(g2, mv, activeMoveDirection);
@@ -1052,5 +1052,6 @@
                             double headingMoveDir = Math.atan2(normalUnitVector.getY(), normalUnitVector.getX());
                             double headingDiff = headingRefWS - headingMoveDir;
-                            if (headingDiff < 0) headingDiff += 2 * Math.PI;
+                            if (headingDiff < 0)
+                                headingDiff += 2 * Math.PI;
                             boolean mirrorRA = Math.abs(headingDiff - Math.PI) > 1e-5;
                             Point pr1 = mv.getPoint(activeMoveDirection.p1);
Index: trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java	(revision 10114)
+++ trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java	(revision 10115)
@@ -49,6 +49,5 @@
      */
     public static WindowGeometry centerOnScreen(Dimension extent, String preferenceKey) {
-        Rectangle size = preferenceKey != null ? getScreenInfo(preferenceKey)
-            : getFullScreenInfo();
+        Rectangle size = preferenceKey != null ? getScreenInfo(preferenceKey) : getFullScreenInfo();
         Point topLeft = new Point(
                 size.x + Math.max(0, (size.width - extent.width) /2),
@@ -117,6 +116,5 @@
      */
     public WindowGeometry(Rectangle rect) {
-        this.topLeft = rect.getLocation();
-        this.extent = rect.getSize();
+        this(rect.getLocation(), rect.getSize());
     }
 
@@ -426,7 +424,5 @@
      */
     private static Rectangle getScreenInfo(Rectangle g) {
-        GraphicsEnvironment ge = GraphicsEnvironment
-                .getLocalGraphicsEnvironment();
-        GraphicsDevice[] gs = ge.getScreenDevices();
+        GraphicsDevice[] gs = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
         int intersect = 0;
         Rectangle bounds = null;
@@ -446,5 +442,5 @@
                     is = b.intersection(g);
                     s = is.width * is.height;
-                    if (bounds == null || intersect < s) {
+                    if (intersect < s) {
                         intersect = s;
                         bounds = b;
@@ -460,5 +456,5 @@
             }
         }
-        return bounds;
+        return bounds != null ? bounds : g;
     }
 
