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.
This commit is contained in:
Christopher Willis-Ford 2018-03-14 16:17:29 -07:00
parent b5d7602f4f
commit 4210c6dd4c

View file

@ -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.