[gnome-control-center/benzea/fix-display-no-mode-scale-crash: 2/3] display: Add guard for NULL mode in supported scale check



commit 0d41cfd6b39935940aa573af3a2e0a1492e6aadc
Author: Benjamin Berg <bberg redhat com>
Date:   Thu Oct 10 09:50:30 2019 +0200

    display: Add guard for NULL mode in supported scale check
    
    This may prevent crashes in certain error situations.

 panels/display/cc-display-config-dbus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/panels/display/cc-display-config-dbus.c b/panels/display/cc-display-config-dbus.c
index 81b2c46f7..cdddbb695 100644
--- a/panels/display/cc-display-config-dbus.c
+++ b/panels/display/cc-display-config-dbus.c
@@ -107,8 +107,10 @@ cc_display_mode_dbus_is_supported_scale (CcDisplayMode *pself,
                                          double scale)
 {
   CcDisplayModeDBus *self = CC_DISPLAY_MODE_DBUS (pself);
-
   guint i;
+
+  g_return_val_if_fail (pself != NULL, FALSE);
+
   for (i = 0; i < self->supported_scales->len; i++)
     if (g_array_index (self->supported_scales, double, i) == scale)
       return TRUE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]