Index: trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialog.java	(revision 9601)
+++ trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialog.java	(revision 9602)
@@ -34,29 +34,49 @@
  * This is non-modal dialog, always showing on top, which displays history information
  * about a given {@link org.openstreetmap.josm.data.osm.OsmPrimitive}.
- *
+ * @since 1709
  */
 public class HistoryBrowserDialog extends JDialog implements HistoryDataSetListener {
 
     /** the embedded browser */
-    private HistoryBrowser browser;
-    private CloseAction closeAction;
-    private JLabel titleLabel;
-
-    /**
-     * displays the title for this dialog
+    private final HistoryBrowser browser = new HistoryBrowser();
+    private final CloseAction closeAction = new CloseAction();
+    private final JLabel titleLabel = new JLabel("", JLabel.CENTER);
+
+    /**
+     * Constructs a new {@code HistoryBrowserDialog}.
+     *
+     * @param history the history to be displayed
+     */
+    public HistoryBrowserDialog(History history) {
+        super(JOptionPane.getFrameForComponent(Main.parent), false);
+        build();
+        setHistory(history);
+        setTitle(buildTitle(history));
+        pack();
+        if (getInsets().top > 0) {
+            titleLabel.setVisible(false);
+        }
+        HistoryDataSet.getInstance().addHistoryDataSetListener(this);
+        addWindowListener(new WindowClosingAdapter());
+    }
+
+    /**
+     * Constructs the title for this dialog
      *
      * @param h the current history
-     */
-    protected void renderTitle(History h) {
-        String title = "";
-        switch(h.getEarliest().getType()) {
-        case NODE:  title = marktr("History for node {0}"); break;
-        case WAY: title = marktr("History for way {0}"); break;
-        case RELATION:  title = marktr("History for relation {0}"); break;
-        }
-        setTitle(tr(
-                title,
-                Long.toString(h.getId())
-        ));
+     * @return the title for this dialog
+     */
+    static String buildTitle(History h) {
+        String title;
+        switch (h.getEarliest().getType()) {
+        case NODE: title = marktr("History for node {0}");
+            break;
+        case WAY: title = marktr("History for way {0}");
+            break;
+        case RELATION: title = marktr("History for relation {0}");
+            break;
+        default: title = "";
+        }
+        return tr(title, Long.toString(h.getId()));
     }
 
@@ -75,9 +95,6 @@
         setLayout(new BorderLayout());
 
-        titleLabel = new JLabel();
-        titleLabel.setHorizontalAlignment(JLabel.CENTER);
         add(titleLabel, BorderLayout.NORTH);
 
-        browser = new HistoryBrowser();
         add(browser, BorderLayout.CENTER);
 
@@ -88,5 +105,5 @@
         pnl.add(btn);
 
-        btn = new SideButton(closeAction = new CloseAction());
+        btn = new SideButton(closeAction);
         final String closeHistoryBrowserDialogKey = "CloseHistoryBrowserDialog";
         KeyStroke escapeKey = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
@@ -105,22 +122,4 @@
 
     /**
-     * Constructs a new {@code HistoryBrowserDialog}.
-     *
-     * @param history the history to be displayed
-     */
-    public HistoryBrowserDialog(History history) {
-        super(JOptionPane.getFrameForComponent(Main.parent), false);
-        build();
-        setHistory(history);
-        renderTitle(history);
-        pack();
-        if (getInsets().top > 0) {
-            titleLabel.setVisible(false);
-        }
-        HistoryDataSet.getInstance().addHistoryDataSetListener(this);
-        addWindowListener(new WindowClosingAdapter());
-    }
-
-    /**
      * Sets the current history.
      * @param history current history
@@ -140,8 +139,12 @@
     /* interface HistoryDataSetListener                                                   */
     /* ---------------------------------------------------------------------------------- */
+
     @Override
     public void historyUpdated(HistoryDataSet source, PrimitiveId primitiveId) {
         if (primitiveId == null || primitiveId.equals(browser.getHistory().getPrimitiveId())) {
-            browser.populate(source.getHistory(browser.getHistory().getPrimitiveId()));
+            History history = source.getHistory(browser.getHistory().getPrimitiveId());
+            if (history != null) {
+                browser.populate(history);
+            }
         }
     }
