Fix #4203 by checking whether a target exists before asking whether it has an variables
This commit is contained in:
1 parent
c50bb3c150
commit
9cd41199c5
1 file changed
+6
-2
+6
-2
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user