From e977d652446bb9f9add22c9f4205799a63dbf566 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 8 Mar 2018 20:12:54 +0100 Subject: [PATCH] monitor: Allow %NULL mode in calculate_mode_scale() If no global scaling factor has been set, we currently segfault when called with a %NULL mode parameter, which happens when calculating the scale for the current mode while no modes are available. Adding %NULL checks in the corresponding callers would mean that we'd have to duplicate the global scaling factor handling, so instead consider %NULL mode parameters valid and handle them gracefully. https://gitlab.gnome.org/GNOME/mutter/merge_requests/41 --- src/backends/meta-monitor.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c index 51c793543..7e8b7c706 100644 --- a/src/backends/meta-monitor.c +++ b/src/backends/meta-monitor.c @@ -1458,6 +1458,9 @@ calculate_scale (MetaMonitor *monitor, scale = 1.0; + if (monitor_mode == NULL) + goto out; + meta_monitor_mode_get_resolution (monitor_mode, &resolution_width, &resolution_height);