mark propositionless search states as solutions
[scpubgit/DX.git] / lib / DX / SearchState.pm
index ee6a1b5..1548f11 100644 (file)
@@ -28,11 +28,16 @@ sub new_for {
   $class->new(
     current_hypothesis => $hyp,
     alternatives => [],
-    next_step => DX::Step::InvokeNextPredicate->new(
-      proposition => $props->members->[0],
-    ),
     propositions => $props,
-    is_solution_state => 0,
+    (@{$props->members}
+      ? (
+          next_step => DX::Step::InvokeNextPredicate->new(
+            proposition => $props->members->[0],
+          ),
+          is_solution_state => 0,
+        )
+      : ( is_solution_state => 1 )
+    ),
   );
 }