diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/ftbsc/geb/GEB.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/ftbsc/geb/GEB.java b/src/main/java/ftbsc/geb/GEB.java index 86e9be5..3a5adf0 100644 --- a/src/main/java/ftbsc/geb/GEB.java +++ b/src/main/java/ftbsc/geb/GEB.java @@ -6,6 +6,7 @@ import ftbsc.geb.api.IEventDispatcher; import ftbsc.geb.api.IListener; import java.util.Map; +import java.util.Optional; import java.util.ServiceLoader; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -69,6 +70,8 @@ public class GEB implements IBus { */ @Override public boolean handleEvent(IEvent event) { - return this.dispatchMap.get(event.getClass()).callListeners(event, this.listenerMap); + return Optional.ofNullable(this.dispatchMap.get(event.getClass())) + .map(dispatcher -> dispatcher.callListeners(event, this.listenerMap)) + .orElse(true); } } |