Fix #4830 for getting/setting unnamed fields

* Returns null when getting unnamed field (value), throws error Field "undefined" not found when attempting to set value of unnamed field
This commit is contained in:
jschanker
2021-06-08 00:26:02 -04:00
committed by Christopher Allen
parent e5a2df301a
commit ee8e282360

View File

@@ -1026,7 +1026,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;
}
}