diff --git a/core/scrollbar.js b/core/scrollbar.js index 42d053cc0..7ac53d06d 100644 --- a/core/scrollbar.js +++ b/core/scrollbar.js @@ -516,7 +516,7 @@ Blockly.Scrollbar.prototype.onScroll_ = function() { var barLength = parseFloat( this.svgBackground_.getAttribute(this.horizontal_ ? 'width' : 'height')); var ratio = knobValue / barLength; - if (isNaN(ratio)) { + if (isNaN(ratio) || !barLength) { ratio = 0; } var xyRatio = {};