aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2023-10-01 07:20:13 +0000
committerDaniel Eklöf <daniel@ekloef.se>2023-10-01 07:20:13 +0000
commitb95a7cb84f9bebdd99ac68d30fa8256cc60dc7ca (patch)
treee8a779e4492310c482f212a499b1cdad385c32b3 /terminal.c
parentconfig: apply overrides even if there's no file (diff)
term: get_font_dpi(): don't crash when there aren't any available monitors
Seen on plasma; monitor is turned off, and then back on again. Before the "new" output global is emitted, the compositor calls fractional_scale::preferred_scale(). This results in a call to get_font_dpi(), where we crash, since it assumes there is at least one monitor available. Fix by falling back to a DPI of 96. Hopefully closes #1498
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/terminal.c b/terminal.c
index 1b082100..06f47685 100644
--- a/terminal.c
+++ b/terminal.c
@@ -826,9 +826,9 @@ get_font_dpi(const struct terminal *term)
: &tll_front(term->wl->monitors);
if (term_fractional_scaling(term))
- return mon->dpi.physical;
+ return mon != NULL ? mon->dpi.physical : 96.;
else
- return mon->dpi.scaled;
+ return mon != NULL ? mon->dpi.scaled : 96.;
}
static enum fcft_subpixel