Skip to content

Commit 8e362f5

Browse files
committed
Avoid a crash
1 parent 54c4a52 commit 8e362f5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/self-model.scm

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,14 @@
628628
;; (DefinedSchema "look at person") to make it look.
629629
(DefineLink
630630
(DefinedPredicate "interact with new person")
631-
(True (Put (DefinedPredicate "Set interaction target")
632-
; If more than one new arrival, pick one randomly.
633-
(RandomChoice (DefinedSchema "New arrivals"))))
631+
; XXX Double-check that the "New arrivals" list is non-empty;
632+
; some OpenPsi bug sometimes sends us here, and the RandomChoice
633+
; crashes if the list is empty.
634+
(SequentialAnd
635+
(DefinedPredicateNode "Did someone arrive?")
636+
(True (Put (DefinedPredicate "Set interaction target")
637+
; If more than one new arrival, pick one randomly.
638+
(RandomChoice (DefinedSchema "New arrivals")))))
634639
)
635640

636641
;; Set eye-contact face to the requested face.

0 commit comments

Comments
 (0)