Skip to content

Commit edf96e7

Browse files
authored
block.js -- dont error if field not found
1 parent d745a6b commit edf96e7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

core/block.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,8 @@ Blockly.Block.prototype.getFieldValue = function(name) {
10201020
Blockly.Block.prototype.setFieldValue = function(newValue, name) {
10211021
var field = this.getField(name);
10221022
goog.asserts.assertObject(field, 'Field "%s" not found.', name);
1023-
field.setValue(newValue);
1023+
if (field) field.setValue(newValue);
1024+
else console.warn(`Field '${name}' not found.`)
10241025
};
10251026

10261027
/**

0 commit comments

Comments
 (0)