Fix possible crash in EventBus

There is currently no way to check if an event handler has been registered or not.
But when trying to unregister a not-registered event handler, Minecraft crashes with a NullPointerException.
This is a simple fix to prevent such crashes.
This commit is contained in:
Björn Zeutzheim committed 2015-08-31 03:39:33 +09:00
1 parent c308a47124
commit ac5c7124de
1 file changed
+2
@@ -121,6 +121,8 @@ public class EventBus implements IEventExceptionHandler
public void unregister(Object object)
{
ArrayList<IEventListener> list = listeners.remove(object);
if (list == null)
return;
for (IEventListener listener : list)
{
ListenerList.unregisterAll(busID, listener);