Browse Source

Check for null

fixes issue 4066
fixes issue 4067

Change-Id: Iaeada7d3db1d7ed9ffab8e8a30294a6f3eb59ba7
Reviewed-on: http://gerrit.dmdirc.com/1187
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
tags/0.6.4
Simon Mott 14 years ago
parent
commit
a494a9d9d8

+ 8
- 4
src/com/dmdirc/addons/ui_swing/framemanager/buttonbar/ButtonBar.java View File

@@ -256,11 +256,11 @@ public final class ButtonBar implements FrameManager, ActionListener,
256 256
             /** {@inheritDoc} */
257 257
             @Override
258 258
             public void run() {
259
-                buttons.remove(window.getContainer());
260
-                relayout();
261 259
                 window.getContainer().removeNotificationListener(ButtonBar.this);
262 260
                 window.getContainer().removeFrameInfoListener(ButtonBar.this);
263 261
                 window.getContainer().removeSelectionListener(ButtonBar.this);
262
+                buttons.remove(window.getContainer());
263
+                relayout();
264 264
             }
265 265
         });
266 266
     }
@@ -383,7 +383,9 @@ public final class ButtonBar implements FrameManager, ActionListener,
383 383
             /** {@inheritDoc} */
384 384
             @Override
385 385
             public void run() {
386
-                buttons.get(window).setIcon(IconManager.getIconManager().getIcon(icon));
386
+                if (buttons.containsKey(window)) {
387
+                    buttons.get(window).setIcon(IconManager.getIconManager().getIcon(icon));
388
+                }
387 389
             }
388 390
         });
389 391
     }
@@ -396,7 +398,9 @@ public final class ButtonBar implements FrameManager, ActionListener,
396 398
             /** {@inheritDoc} */
397 399
             @Override
398 400
             public void run() {
399
-                buttons.get(window).setText(name);
401
+                if (buttons.containsKey(window)) {
402
+                    buttons.get(window).setText(name);
403
+                }
400 404
             }
401 405
         });
402 406
     }

Loading…
Cancel
Save