wayland: don’t crash with a division-by-zero when monitor dimensions are negative

Some compositors set the physical dimensions to -1...
This commit is contained in:
Daniel Eklöf 2022-09-22 18:33:24 +02:00
parent b7ba842237
commit 50ae277d90
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -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;