From 7c1236e18f70524a05e9b5a15b786b6fc7ccc3d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Sun, 7 May 2023 01:24:44 -0400
Subject: [PATCH] "Fix" a couple impossible ways for vstat.scaling to be zero.

Seriously, that's not possible.
---
 src/conio/bitmap_con.c | 2 ++
 src/conio/x_events.c   | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/conio/bitmap_con.c b/src/conio/bitmap_con.c
index 16af30700d..4e4714b4d7 100644
--- a/src/conio/bitmap_con.c
+++ b/src/conio/bitmap_con.c
@@ -1663,6 +1663,8 @@ bitmap_largest_mult_inside(int maxwidth, int maxheight)
 		mult = maxwidth / vstat.scrnwidth;
 	else
 		mult = maxheight / vstat.scrnheight;
+	if (mult < 1)
+		mult = 1;
 	for (;mult > 1; mult--) {
 		bitmap_get_scaled_win_size(mult, &w, &h, 0, 0);
 		if (w <= maxwidth && h <= maxheight)
diff --git a/src/conio/x_events.c b/src/conio/x_events.c
index dc7cc50145..da46ab3365 100644
--- a/src/conio/x_events.c
+++ b/src/conio/x_events.c
@@ -542,7 +542,7 @@ static int video_init()
 	   lot easier. */
 
 	pthread_mutex_lock(&vstatlock);
-	if (x_cvstat.scaling < 1)
+	if (x_cvstat.scaling < 1 || vstat.scaling < 1)
 		x_cvstat.scaling = vstat.scaling = 1;
 	if (ciolib_initial_scaling)
 		x_cvstat.scaling = vstat.scaling = ciolib_initial_scaling;
-- 
GitLab