From 50ae277d90c1eea6bb0086c31e004042088f794f Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 22 Sep 2022 18:33:24 +0200 Subject: wayland: don’t crash with a division-by-zero when monitor dimensions are negative MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some compositors set the physical dimensions to -1... --- wayland.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wayland.c b/wayland.c index 05de79aa..cd052532 100644 --- a/wayland.c +++ b/wayland.c @@ -367,7 +367,7 @@ update_terms_on_monitor(struct monitor *mon) static void output_update_ppi(struct monitor *mon) { - if (mon->dim.mm.width == 0 || mon->dim.mm.height == 0) + if (mon->dim.mm.width <= 0 || mon->dim.mm.height <= 0) return; int x_inches = mon->dim.mm.width * 0.03937008; -- cgit v1.3