From 341dba596528b8c356d1db53f2f1266fa28c0322 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Tue, 30 Nov 2021 10:25:16 -0800 Subject: [PATCH] fix: Prevent error when maxTrashcanContents is 0 (#5739) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Prevent error when maxTrashcanContents is 0 Resolves #5729. * Eliminate ’smart’ quotes. --- core/interfaces/i_positionable.js | 2 +- core/trashcan.js | 4 ++-- core/zoom_controls.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/interfaces/i_positionable.js b/core/interfaces/i_positionable.js index 82c49c3fe..a8fc918bd 100644 --- a/core/interfaces/i_positionable.js +++ b/core/interfaces/i_positionable.js @@ -43,7 +43,7 @@ IPositionable.prototype.position; /** * Returns the bounding rectangle of the UI element in pixel units relative to * the Blockly injection div. - * @return {?Rect} The UI elements’s bounding box. Null if + * @return {?Rect} The UI elements's bounding box. Null if * bounding box should be ignored by other UI elements. */ IPositionable.prototype.getBoundingRectangle; diff --git a/core/trashcan.js b/core/trashcan.js index 3ef5ec3c0..698eb7a74 100644 --- a/core/trashcan.js +++ b/core/trashcan.js @@ -387,7 +387,7 @@ Trashcan.prototype.hasContents_ = function() { * @return {boolean} True if the trashcan contents-flyout is currently open. */ Trashcan.prototype.contentsIsOpen = function() { - return this.flyout.isVisible(); + return !!this.flyout && this.flyout.isVisible(); }; /** @@ -480,7 +480,7 @@ Trashcan.prototype.position = function(metrics, savedPositions) { /** * Returns the bounding rectangle of the UI element in pixel units relative to * the Blockly injection div. - * @return {?Rect} The UI elements’s bounding box. Null if + * @return {?Rect} The UI elements's bounding box. Null if * bounding box should be ignored by other UI elements. */ Trashcan.prototype.getBoundingRectangle = function() { diff --git a/core/zoom_controls.js b/core/zoom_controls.js index 70ea5ecb2..28b2b5c32 100644 --- a/core/zoom_controls.js +++ b/core/zoom_controls.js @@ -234,7 +234,7 @@ ZoomControls.prototype.dispose = function() { /** * Returns the bounding rectangle of the UI element in pixel units relative to * the Blockly injection div. - * @return {?Rect} The UI elements’s bounding box. Null if + * @return {?Rect} The UI elements's bounding box. Null if * bounding box should be ignored by other UI elements. */ ZoomControls.prototype.getBoundingRectangle = function() {