summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mannehed <samuel@cendio.se>2019-03-08 16:30:43 +0100
committerSamuel Mannehed <samuel@cendio.se>2019-03-08 16:30:43 +0100
commit6e7e6f9c9ed3367ecaa80f78a512187a7ae95eb4 (patch)
treee094d1c8ef00f7627110f151037f760e6baca6cd
parent9a823732a01af080357669d12d355cdc8e7e099c (diff)
downloadnovnc-6e7e6f9c9ed3367ecaa80f78a512187a7ae95eb4.tar.gz
Add check for bad values for Display.autoscale()
-rw-r--r--core/display.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/display.js b/core/display.js
index 73e0387..25a9595 100644
--- a/core/display.js
+++ b/core/display.js
@@ -495,6 +495,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;