Index: src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
===================================================================
--- src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java	(revision 2184)
+++ src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java	(working copy)
@@ -5,6 +5,7 @@
 import java.awt.BorderLayout;
 import java.awt.Component;
 import java.awt.Dimension;
+import java.awt.Graphics;
 import java.awt.GridBagLayout;
 import java.awt.Image;
 import java.awt.Rectangle;
@@ -23,6 +24,7 @@
 import javax.swing.Box;
 import javax.swing.ImageIcon;
 import javax.swing.JButton;
+import javax.swing.JComponent;
 import javax.swing.JDialog;
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;
@@ -414,7 +416,7 @@
      * 
      */
     private class TitleBar extends JPanel {
-        private JLabel leftPart;
+        final private JLabel lblTitle;
 
         public TitleBar(String toggleDialogName, String iconName) {
             setLayout(new GridBagLayout());
@@ -424,10 +426,25 @@
             // scale down the dialog icon
             ImageIcon inIcon = ImageProvider.get("dialogs", iconName);
             ImageIcon smallIcon = new ImageIcon(inIcon.getImage().getScaledInstance(16 , 16, Image.SCALE_SMOOTH));
-            leftPart = new JLabel("",smallIcon, JLabel.TRAILING);
-            leftPart.setIconTextGap(8);
-            add(leftPart, GBC.std());
-            add(Box.createHorizontalGlue(),GBC.std().fill(GBC.HORIZONTAL));
+            lblTitle = new JLabel("",smallIcon, JLabel.TRAILING);
+            lblTitle.setIconTextGap(8);
+            
+            JPanel conceal = new JPanel();
+            conceal.add(lblTitle);
+            conceal.setVisible(false);
+            add(conceal, GBC.std());
+            
+            // Cannot add the label directly since it would displace other elements on resize
+            JComponent lblTitle_weak = new JComponent() {
+                @Override
+                public void paintComponent(Graphics g) {
+                    lblTitle.paint(g);
+                }
+            };
+            lblTitle_weak.setPreferredSize(new Dimension(Integer.MAX_VALUE,20));
+            lblTitle_weak.setMinimumSize(new Dimension(0,20));
+            add(lblTitle_weak, GBC.std().fill(GBC.HORIZONTAL));
+
             addMouseListener(
                     new MouseAdapter() {
                         @Override
@@ -467,11 +484,11 @@
         }
 
         public void setTitle(String title) {
-            leftPart.setText(title);
+            lblTitle.setText(title);
         }
 
         public String getTitle() {
-            return leftPart.getText();
+            return lblTitle.getText();
         }
     }
 
Index: src/org/openstreetmap/josm/Main.java
===================================================================
--- src/org/openstreetmap/josm/Main.java	(revision 2184)
+++ src/org/openstreetmap/josm/Main.java	(working copy)
@@ -525,7 +525,7 @@
     static public void saveGuiGeometry() {
         // save the current window geometry and the width of the toggle dialog area
         String newGeometry = "";
-        String newToggleDlgWidth = "";
+        String newToggleDlgWidth = null;
         try {
             if (((JFrame)parent).getExtendedState() == JFrame.NORMAL) {
                 Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
@@ -548,16 +548,21 @@
                 }
                 newGeometry = width + "x" + height + "+" + x + "+" + y;
             }
-
-            newToggleDlgWidth = Integer.toString(map.getToggleDlgWidth());
-            if (newToggleDlgWidth.equals(Integer.toString(map.DEF_TOGGLE_DLG_WIDTH))) {
-                newToggleDlgWidth = "";
+            
+            if (map  != null) {
+                newToggleDlgWidth = Integer.toString(map.getToggleDlgWidth());
+                if (newToggleDlgWidth.equals(Integer.toString(map.DEF_TOGGLE_DLG_WIDTH))) {
+                    newToggleDlgWidth = "";
+                }
             }
         }
         catch (Exception e) {
             System.out.println("Failed to save GUI geometry: " + e);
+            e.printStackTrace();
         }
         pref.put("gui.geometry", newGeometry);
-        pref.put("toggleDialogs.width", newToggleDlgWidth);
+        if (newToggleDlgWidth != null) {
+            pref.put("toggleDialogs.width", newToggleDlgWidth);
+        }
     }
 }
