Merge pull request #2120 from luacs1998/eventbus_fix
Fix a possible crash in EventBus
This commit is contained in:
commit
90829a3164
1 changed files with 2 additions and 0 deletions
|
@ -121,6 +121,8 @@ public class EventBus implements IEventExceptionHandler
|
||||||
public void unregister(Object object)
|
public void unregister(Object object)
|
||||||
{
|
{
|
||||||
ArrayList<IEventListener> list = listeners.remove(object);
|
ArrayList<IEventListener> list = listeners.remove(object);
|
||||||
|
if(list == null)
|
||||||
|
return;
|
||||||
for (IEventListener listener : list)
|
for (IEventListener listener : list)
|
||||||
{
|
{
|
||||||
ListenerList.unregisterAll(busID, listener);
|
ListenerList.unregisterAll(busID, listener);
|
||||||
|
|
Loading…
Reference in a new issue