Correctly deal with empty substacks.

The stack needs to be popped in this situation.
This commit is contained in:
Tim Mickel 2016-06-10 08:47:54 -04:00
parent 559a2a0fab
commit 7cc0c00da6

View file

@ -81,7 +81,9 @@ Sequencer.prototype.stepThreads = function (threads) {
*/
Sequencer.prototype.startThread = function (thread) {
var currentBlockId = thread.peekStack();
if (!currentBlockId || !this.runtime.blocks.getBlock(currentBlockId)) {
if (!currentBlockId) {
// A "null block" - empty substack. Pop the stack.
thread.popStack();
thread.status = Thread.STATUS_DONE;
return;
}