mirror of
https://github.com/google/blockly.git
synced 2026-03-10 07:10:11 +01:00
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:
committed by
Christopher Allen
parent
e5a2df301a
commit
ee8e282360
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user