Skip to content
Snippets Groups Projects
Unverified Commit 57751e9d authored by Karishma Chadha's avatar Karishma Chadha Committed by GitHub
Browse files

Merge pull request #4204 from picklesrus/sensing-target-bug

Fix #4203 by checking whether a target exists before asking whether i…
parents c50bb3c1 9cd41199
No related branches found
No related tags found
No related merge requests found
......@@ -260,8 +260,12 @@ export default function (vm) {
return stageOptions.concat(stageVariableMenuItems);
}
// Get all the local variables (no lists) and add them to the menu.
const spriteVariableOptions =
vm.runtime.getSpriteTargetByName(selectedItem).getAllVariableNamesInScopeByType('', true);
const target = vm.runtime.getSpriteTargetByName(selectedItem);
let spriteVariableOptions = [];
// The target should exist, but there are ways for it not to (e.g. #4203).
if (target) {
spriteVariableOptions = target.getAllVariableNamesInScopeByType('', true);
}
const spriteVariableMenuItems = spriteVariableOptions.map(variable => [variable, variable]);
return spriteOptions.concat(spriteVariableMenuItems);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment