From 37d0b6e606b1ed7cc951ff6409db37f175876d8f Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 7 Apr 2022 19:38:43 -0400 Subject: [PATCH] Add some basic sanity checks for width & height == 0 --- web/skins/classic/views/js/watch.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/web/skins/classic/views/js/watch.js b/web/skins/classic/views/js/watch.js index 5f05968cf..5f07f557a 100644 --- a/web/skins/classic/views/js/watch.js +++ b/web/skins/classic/views/js/watch.js @@ -170,12 +170,17 @@ function changeScale() { // This is so that we don't waste bandwidth and let the browser do all the scaling. if (autoScale > 100) autoScale = 100; if (scale > 100) scale = 100; + if (autoScale <= 0) autoScale = 100; const newSrc = oldSrc.replace(/scale=\d+/i, 'scale='+((scale == 'auto' || scale == '0') ? autoScale : scale)); - streamImg.css('width', newWidth+'px'); - streamImg.width(newWidth); - streamImg.css('height', newHeight+'px'); - streamImg.height(newHeight); + if (parseInt(newWidth) > 0) { + streamImg.css('width', newWidth+'px'); + streamImg.width(newWidth); + } + if (parseInt(newHeight) > 0) { + streamImg.css('height', newHeight+'px'); + streamImg.height(newHeight); + } streamImg.attr('src', newSrc); } else { console.log("Not an IMG, can't set size");