Treat a null state as a failed state.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 2 Jan 2013 20:12:58 +0000 (21:12 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 2 Jan 2013 20:15:06 +0000 (21:15 +0100)
src/main/java/net/pterodactylus/reactor/engine/Engine.java

index a8c9f4e..949ce12 100644 (file)
@@ -27,6 +27,7 @@ import net.pterodactylus.reactor.Query;
 import net.pterodactylus.reactor.Reaction;
 import net.pterodactylus.reactor.Trigger;
 import net.pterodactylus.reactor.states.AbstractState;
+import net.pterodactylus.reactor.states.FailedState;
 
 import org.apache.log4j.Logger;
 
@@ -122,6 +123,9 @@ public class Engine extends AbstractExecutionThreadService {
                        try {
                                logger.debug("Querying system...");
                                state = query.state();
+                               if (state == null) {
+                                       state = FailedState.INSTANCE;
+                               }
                                logger.debug("System queried.");
                        } catch (Throwable t1) {
                                logger.warn("Querying system failed!", t1);