Преглед на файлове

Fix NPE in channel creation.

Change-Id: I7b349f13727fb42ca3015ac7cdd42c832ea8fc79
Fixes-Issue: CLIENT-466
Reviewed-on: http://gerrit.dmdirc.com/3225
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.8
Greg Holmes преди 10 години
родител
ревизия
9e4b8c7d67
променени са 1 файла, в които са добавени 6 реда и са изтрити 4 реда
  1. 6
    4
      src/com/dmdirc/addons/ui_swing/components/TopicBar.java

+ 6
- 4
src/com/dmdirc/addons/ui_swing/components/TopicBar.java Целия файл

@@ -348,8 +348,10 @@ public class TopicBar extends JComponent implements ActionListener,
348 348
         topicText.setFocusable(false);
349 349
         topicText.setEditable(false);
350 350
         topicCancel.setVisible(false);
351
-        ((ChannelFrame) windowFactory.getSwingWindow(channel))
352
-                .getInputField().requestFocusInWindow();
351
+        final ChannelFrame channelFrame = (ChannelFrame) windowFactory.getSwingWindow(channel);
352
+        if (channelFrame != null) {
353
+            channelFrame.getInputField().requestFocusInWindow();
354
+        }
353 355
         topicChanged(channel, null);
354 356
     }
355 357
 
@@ -375,8 +377,7 @@ public class TopicBar extends JComponent implements ActionListener,
375 377
     /**
376 378
      * Load and set colours.
377 379
      */
378
-    private void setColours(){
379
-        cancelTopicEdit();
380
+    private void setColours() {
380 381
         backgroundColour = UIUtilities.convertColour(
381 382
                 colourManager.getColourFromString(
382 383
                         channel.getConfigManager().getOptionString(
@@ -499,6 +500,7 @@ public class TopicBar extends JComponent implements ActionListener,
499 500
     public void configChanged(final String domain, final String key) {
500 501
         updateOptions();
501 502
         setVisible(showBar);
503
+        cancelTopicEdit();
502 504
         if ("showfulltopic".equals(key)) {
503 505
             topicText.setEditorKit(new WrapEditorKit(showFull));
504 506
             ((DefaultStyledDocument) topicText.getDocument()).setDocumentFilter(

Loading…
Отказ
Запис