Skip to content

Commit

Permalink
Fix google#4830 for getting/setting unnamed fields
Browse files Browse the repository at this point in the history
* Returns null when getting unnamed field (value), throws error Field "undefined" not found when attempting to set value of unnamed field
  • Loading branch information
jschanker committed Jun 8, 2021
1 parent ab5616c commit b1ad76d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ Blockly.Block.prototype.setOnChange = function(onchangeFn) {
Blockly.Block.prototype.getField = function(name) {
for (var i = 0, input; (input = this.inputList[i]); i++) {
for (var j = 0, field; (field = input.fieldRow[j]); j++) {
if (field.name == name) {
if (typeof field.name !== "undefined" && field.name == name) {
return field;
}
}
Expand Down

0 comments on commit b1ad76d

Please sign in to comment.