From 4210c6dd4c7726af12ab8c3ca6785c620f4723ce Mon Sep 17 00:00:00 2001
From: Christopher Willis-Ford <cwillisf@media.mit.edu>
Date: Wed, 14 Mar 2018 16:17:29 -0700
Subject: [PATCH] Fix stack check in `stepThread`

The previous logic seemed to be expecting `peekStack` to return 0 when
the stack was empty, but its return type is `?string` and it returns
`undefined` when the stack is empty. The `!== 0` check would never pass,
then, leading to problems with (for example) the "say/think and wait"
blocks.
---
 src/engine/sequencer.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/engine/sequencer.js b/src/engine/sequencer.js
index 2db6054b7..ce65163d4 100644
--- a/src/engine/sequencer.js
+++ b/src/engine/sequencer.js
@@ -175,7 +175,7 @@ class Sequencer {
             thread.popStack();
         }
         // Save the current block ID to notice if we did control flow.
-        while ((currentBlockId = thread.peekStack()) !== 0) {
+        while ((currentBlockId = thread.peekStack())) {
             let isWarpMode = thread.peekStackFrame().warpMode;
             if (isWarpMode && !thread.warpTimer) {
                 // Initialize warp-mode timer if it hasn't been already.