From 05351569c5d25e0c04bfe0ac63d0871f4719f18a Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Thu, 7 Dec 2017 16:08:00 -0800 Subject: [PATCH] Fix html escaping and flyouts opening --- core/block.js | 7 ++++++- core/variables.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/block.js b/core/block.js index 1c20108b7..c6f400619 100644 --- a/core/block.js +++ b/core/block.js @@ -695,7 +695,12 @@ Blockly.Block.prototype.getVarModels = function() { for (var i = 0, input; input = this.inputList[i]; i++) { for (var j = 0, field; field = input.fieldRow[j]; j++) { if (field instanceof Blockly.FieldVariable) { - vars.push(this.workspace.getVariableById(field.getValue())); + var model = this.workspace.getVariableById(field.getValue()); + // Check if the variable actually exists (and isn't just a potential + // variable). + if (model) { + vars.push(model); + } } } } diff --git a/core/variables.js b/core/variables.js index 676223c24..b8d40028b 100644 --- a/core/variables.js +++ b/core/variables.js @@ -336,7 +336,7 @@ Blockly.Variables.generateVariableFieldXml_ = function(variableModel) { } var text = '' + variableModel.name + ''; + '">' + goog.string.htmlEscape(variableModel.name) + ''; return text; };