소스 검색

Fix error trying to save CSD settings.

Because of the ordering of assignments in ChannelSettingsDialog's ctor,
we weren't assigning the global config before passing it in to the
list modes pane. This caused NPEs if toggling the 'show extended info'
option and saving.

Change-Id: I89f1ca9e29aa38fcf278e9afd2b9fbc214b4fbe3
Fixes-Issue: CLIENT-454
Reviewed-on: http://gerrit.dmdirc.com/3212
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.8
Chris Smith 10 년 전
부모
커밋
8664b2ef3c

+ 7
- 5
src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/ChannelListModesPane.java 파일 보기

62
 
62
 
63
 import net.miginfocom.swing.MigLayout;
63
 import net.miginfocom.swing.MigLayout;
64
 
64
 
65
+import static com.google.common.base.Preconditions.checkNotNull;
66
+
65
 /** List modes panel. */
67
 /** List modes panel. */
66
 public final class ChannelListModesPane extends JPanel implements ActionListener,
68
 public final class ChannelListModesPane extends JPanel implements ActionListener,
67
         ListSelectionListener, ConfigChangeListener {
69
         ListSelectionListener, ConfigChangeListener {
120
             final Window parentWindow) {
122
             final Window parentWindow) {
121
         super();
123
         super();
122
 
124
 
123
-        this.globalConfig = globalConfig;
124
-        this.userConfig = userConfig;
125
-        this.iconManager = iconManager;
125
+        this.globalConfig = checkNotNull(globalConfig);
126
+        this.userConfig = checkNotNull(userConfig);
127
+        this.iconManager = checkNotNull(iconManager);
128
+        this.channel = checkNotNull(channel);
129
+        this.parentWindow = checkNotNull(parentWindow);
126
         this.setOpaque(UIUtilities.getTabbedPaneOpaque());
130
         this.setOpaque(UIUtilities.getTabbedPaneOpaque());
127
-        this.channel = channel;
128
-        this.parentWindow = parentWindow;
129
 
131
 
130
         list = new JList<>();
132
         list = new JList<>();
131
         nativeRenderer = list.getCellRenderer();
133
         nativeRenderer = list.getCellRenderer();

+ 14
- 12
src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/ChannelSettingsDialog.java 파일 보기

49
 
49
 
50
 import net.miginfocom.swing.MigLayout;
50
 import net.miginfocom.swing.MigLayout;
51
 
51
 
52
+import static com.google.common.base.Preconditions.checkNotNull;
53
+
52
 /**
54
 /**
53
  * Allows the user to modify channel settings (modes, topics, etc).
55
  * Allows the user to modify channel settings (modes, topics, etc).
54
  */
56
  */
99
      * @param serviceManager     Service manager
101
      * @param serviceManager     Service manager
100
      * @param preferencesManager Preferences Manager
102
      * @param preferencesManager Preferences Manager
101
      * @param compFactory        Preferences setting component factory
103
      * @param compFactory        Preferences setting component factory
102
-     * @param newChannel         The channel object that we're editing settings for
104
+     * @param channel            The channel object that we're editing settings for
103
      * @param parentWindow       Parent window
105
      * @param parentWindow       Parent window
104
      */
106
      */
105
     public ChannelSettingsDialog(
107
     public ChannelSettingsDialog(
112
             final ServiceManager serviceManager,
114
             final ServiceManager serviceManager,
113
             final PreferencesManager preferencesManager,
115
             final PreferencesManager preferencesManager,
114
             final PrefsComponentFactory compFactory,
116
             final PrefsComponentFactory compFactory,
115
-            final Channel newChannel,
117
+            final Channel channel,
116
             final MainFrame parentWindow) {
118
             final MainFrame parentWindow) {
117
         super(parentWindow, ModalityType.MODELESS);
119
         super(parentWindow, ModalityType.MODELESS);
118
 
120
 
119
-        this.controller = controller;
120
-        this.iconManager = iconManager;
121
-        this.userConfig = userConfig;
122
-        this.serviceManager = serviceManager;
123
-        this.preferencesManager = preferencesManager;
124
-        this.compFactory = compFactory;
121
+        this.controller = checkNotNull(controller);
122
+        this.iconManager = checkNotNull(iconManager);
123
+        this.globalConfig = checkNotNull(globalConfig);
124
+        this.userConfig = checkNotNull(userConfig);
125
+        this.serviceManager = checkNotNull(serviceManager);
126
+        this.preferencesManager = checkNotNull(preferencesManager);
127
+        this.compFactory = checkNotNull(compFactory);
128
+        this.channel = checkNotNull(channel);
125
 
129
 
126
-        channel = newChannel;
127
-        identity = identityFactory.createChannelConfig(channel.getConnection().getNetwork(),
130
+        this.identity = identityFactory.createChannelConfig(channel.getConnection().getNetwork(),
128
                 channel.getChannelInfo().getName());
131
                 channel.getChannelInfo().getName());
129
-        this.channelWindow = (InputWindow) windowFactory.getSwingWindow(newChannel);
132
+        this.channelWindow = (InputWindow) windowFactory.getSwingWindow(channel);
130
 
133
 
131
         initComponents();
134
         initComponents();
132
         initListeners();
135
         initListeners();
133
-        this.globalConfig = globalConfig;
134
     }
136
     }
135
 
137
 
136
     /** Initialises the main UI components. */
138
     /** Initialises the main UI components. */

Loading…
취소
저장