Implement extra null checks on flydown
@@ -66,9 +66,14 @@ Blockly.BlockSvg.prototype.onMouseDown_ = (function(func) {
workspace.getParentSvg().parentNode.focus();
}
if (Blockly.FieldFlydown.openFieldFlydown_) {
- if (goog.dom.contains(Blockly.getMainWorkspace().flydown_.svgGroup_, this.svgGroup_)) {
+ var flydown = Blockly.getMainWorkspace().getFlydown();
+ if (flydown) {
+ if (goog.dom.contains(flydown.svgGroup_, this.svgGroup_)) {
//prevent hiding the flyout if a child block is the target
- Blockly.getMainWorkspace().flydown_.shouldHide = false;
+ flydown.shouldHide = false;
+ }
+ } else {
+ console.warn('openFieldFlydown_ was set but flydown_ was undefined!');
}
}
var retval = func.call(this, e);
