mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 19:39:22 +00:00
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:
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);
|
||||
|
||||
Reference in new issue
Block a user