From 175ebb010477ff0e174fe5145154397f43dee2d2 Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Thu, 11 Feb 2021 16:53:13 +0100 Subject: [PATCH] Don't crash if we can't find a monitor model name This can happen when running emacs over a forwarded X11 connection. * src/pgtkfns.c (pgtk_get_monitor_scale_factor): Return 0 if we're passed a NULL model name. --- src/pgtkfns.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pgtkfns.c b/src/pgtkfns.c index cee24c1ad12..07636a25ca0 100644 --- a/src/pgtkfns.c +++ b/src/pgtkfns.c @@ -66,6 +66,9 @@ static Lisp_Object monitor_scale_factor_alist; static double pgtk_get_monitor_scale_factor (const char *model) { + if (model == NULL) + return 0.0; + Lisp_Object mdl = build_string (model); Lisp_Object tem = Fassoc(mdl, monitor_scale_factor_alist, Qnil); if (NILP (tem)) -- 2.39.5