Selaa lähdekoodia

Fix NPE if removing non-existant listener type

Fixes issue 4039

Change-Id: Ie5ff2edc27c062cf6ff671a8cc88bcd2c80da075
Reviewed-on: http://gerrit.dmdirc.com/1184
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
tags/0.6.4
Chris Smith 14 vuotta sitten
vanhempi
commit
0d83d4fe23
1 muutettua tiedostoa jossa 7 lisäystä ja 4 poistoa
  1. 7
    4
      src/com/dmdirc/util/ListenerList.java

+ 7
- 4
src/com/dmdirc/util/ListenerList.java Näytä tiedosto

49
     /**
49
     /**
50
      * Adds a new listener of the specified type to this listener list.
50
      * Adds a new listener of the specified type to this listener list.
51
      * 
51
      * 
52
+     * @param <T> The type of listener to be added
52
      * @param listenerType The type of listener to be added
53
      * @param listenerType The type of listener to be added
53
      * @param listener The listener to be added
54
      * @param listener The listener to be added
54
      */
55
      */
77
     /**
78
     /**
78
      * Removes the specified listener from the list of listeners for the
79
      * Removes the specified listener from the list of listeners for the
79
      * specified type.
80
      * specified type.
80
-     * 
81
+     *
82
+     * @param <T> The type of listener to be removed
81
      * @param listenerType The type that the listener should be removed from
83
      * @param listenerType The type that the listener should be removed from
82
      * @param listener The listener to be removed
84
      * @param listener The listener to be removed
83
      */
85
      */
84
     public <T> void remove(final Class<T> listenerType, final T listener) {
86
     public <T> void remove(final Class<T> listenerType, final T listener) {
85
-        listeners.get(listenerType).remove(listener);
87
+        get(listenerType).remove(listener);
86
     }
88
     }
87
     
89
     
88
     /**
90
     /**
94
      * @param listener The listener to be removed
96
      * @param listener The listener to be removed
95
      */
97
      */
96
     public void remove(final String listenerType, final Object listener) {
98
     public void remove(final String listenerType, final Object listener) {
97
-        listeners.get(listenerType).remove(listener);
99
+        get(listenerType).remove(listener);
98
     }
100
     }
99
     
101
     
100
     /**
102
     /**
101
      * Retrieves the list of listeners for the specified type.
103
      * Retrieves the list of listeners for the specified type.
102
-     * 
104
+     *
105
+     * @param <T> The type of listener to be retrieved
103
      * @param listenerType The type of listener that's being retrieved
106
      * @param listenerType The type of listener that's being retrieved
104
      * @return A list of listeners for the specified type
107
      * @return A list of listeners for the specified type
105
      */
108
      */

Loading…
Peruuta
Tallenna