diff --git a/core/field_dropdown.js b/core/field_dropdown.js index 1fd490a990..54c53f07f3 100644 --- a/core/field_dropdown.js +++ b/core/field_dropdown.js @@ -164,7 +164,7 @@ Blockly.FieldDropdown.prototype.init = function() { */ Blockly.FieldDropdown.prototype.showEditor_ = function() { var options = this.getOptions(); - if (options.length == 0) return; + if (options.length == 0 || JSON.stringify(options) === '[""]') return; this.dropDownOpen_ = true; // If there is an existing drop-down someone else owns, hide it immediately and clear it. @@ -331,10 +331,15 @@ Blockly.FieldDropdown.prototype.isOptionListDynamic = function() { * (human-readable text or image, language-neutral name). */ Blockly.FieldDropdown.prototype.getOptions = function() { + var options = []; + if (goog.isFunction(this.menuGenerator_)) { - return this.menuGenerator_.call(this); - } - return /** @type {!Array.>} */ (this.menuGenerator_); + options = this.menuGenerator_.call(this); + } else options = (this.menuGenerator_); + + /** @type {!Array.>} */ + if (options.length > 0) return options; + return ['']; }; /**