From 79ab05192b95ffa679b4188b05fc9bc28c121182 Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Fri, 8 Mar 2019 16:30:43 +0100 Subject: [PATCH] Add check for bad values for Display.autoscale() --- kasmweb/core/display.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kasmweb/core/display.js b/kasmweb/core/display.js index acc1878..4df9d17 100644 --- a/kasmweb/core/display.js +++ b/kasmweb/core/display.js @@ -503,6 +503,11 @@ export default class Display { } autoscale(containerWidth, containerHeight) { + if (containerWidth === 0 || containerHeight === 0) { + Log.Warn("Autoscale doesn't work when width or height is zero"); + return; + } + const vp = this._viewportLoc; const targetAspectRatio = containerWidth / containerHeight; const fbAspectRatio = vp.w / vp.h;