mirror of
https://github.com/google/blockly.git
synced 2026-01-10 02:17:09 +01:00
Dropdown Create does not create a missing variable twice.
This commit is contained in:
@@ -148,7 +148,7 @@ Blockly.FieldVariable.dropdownCreate = function() {
|
||||
if (workspace) {
|
||||
// Get a copy of the list, so that adding rename and new variable options
|
||||
// doesn't modify the workspace's list.
|
||||
var variableModelList = workspace.getVariablesOfType('');
|
||||
variableModelList = workspace.getVariablesOfType('');
|
||||
for (var i = 0; i < variableModelList.length; i++){
|
||||
if (createSelectedVariable &&
|
||||
goog.string.caseInsensitiveEquals(variableModelList[i].name, name)) {
|
||||
|
||||
@@ -211,7 +211,7 @@ Blockly.VariableMap.prototype.getVariablesOfType = function(type) {
|
||||
type = type || '';
|
||||
var variable_list = this.variableMap_[type];
|
||||
if (variable_list) {
|
||||
return variable_list;
|
||||
return variable_list.slice();
|
||||
}
|
||||
return [];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user