From b1ad76dbfe3b99e9118064c09eb66455656d63bb Mon Sep 17 00:00:00 2001 From: jschanker Date: Tue, 8 Jun 2021 00:26:02 -0400 Subject: [PATCH] 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 --- core/block.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/block.js b/core/block.js index d081bc88928..00ee9d01178 100644 --- a/core/block.js +++ b/core/block.js @@ -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; } }