pxt
pxt copied to clipboard
BUG Converting upvar blocks to JavaScript: TypeError: null is not an object (evaluating 'block.getField('VAR').getText')

Trying to convert this innocuous, default for each block into JavaScript results in the error
TypeError: null is not an object (evaluating 'block.getField('VAR').getText')
var variable0 = Blockly.JavaScript.variableDB_.getName(
block.getField('VAR').getText(), Blockly.Variables.NAME_TYPE);
What's the fix for this?
can be fixed by changing the line to
var variable0 = Blockly.JavaScript.variableDB_.getName(
block.getInputTargetBlock('VAR').getField('VAR').getText(), Blockly.Variables.NAME_TYPE);