Fix check for existing hat threads (#269)

This commit is contained in:
Tim Mickel 2016-10-13 22:14:19 -04:00 committed by GitHub
parent 1e86d48a31
commit c45b420115

View file

@ -344,7 +344,7 @@ Runtime.prototype.startHats = function (requestedHatOpcode,
// any existing threads starting with the top block. // any existing threads starting with the top block.
for (var i = 0; i < instance.threads.length; i++) { for (var i = 0; i < instance.threads.length; i++) {
if (instance.threads[i].topBlock === topBlockId && if (instance.threads[i].topBlock === topBlockId &&
(!opt_target || instance.threads[i].target == opt_target)) { instance.threads[i].target == target) {
instance._removeThread(instance.threads[i]); instance._removeThread(instance.threads[i]);
} }
} }
@ -353,7 +353,7 @@ Runtime.prototype.startHats = function (requestedHatOpcode,
// give up if any threads with the top block are running. // give up if any threads with the top block are running.
for (var j = 0; j < instance.threads.length; j++) { for (var j = 0; j < instance.threads.length; j++) {
if (instance.threads[j].topBlock === topBlockId && if (instance.threads[j].topBlock === topBlockId &&
(!opt_target || instance.threads[j].target == opt_target)) { instance.threads[j].target == target) {
// Some thread is already running. // Some thread is already running.
return; return;
} }