Skip to content

Commit c1b2207

Browse files
committed
Close the rename dialog when the variable is gone
1 parent a88d380 commit c1b2207

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎core/variables.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,10 @@ Blockly.Variables.renameVariable = function(workspace, variable,
504504
var additionalVarNames = variable.isLocal ? [] : additionalVars;
505505
var validatedText = validate(newName, workspace, additionalVarNames, variable.isCloud);
506506
if (validatedText) {
507+
// (collaboration) Somebody else may have deleted this variable while the dialog was open.
508+
if (!workspace.getVariableById(variable.getId())) {
509+
return;
510+
}
507511
workspace.renameVariableById(variable.getId(), validatedText);
508512
if (opt_callback) {
509513
opt_callback(newName);

0 commit comments

Comments
 (0)