[PATCH 4/6] gnome-control-center: handle the case when no screens are connected



If no screens are detected as connected then the mode variable
will be uninitialised, and so will cause a segfault. It also
adds another NULL check for safety.

--- gnome-control-center-2.22.1/capplets/display/xrandr-capplet.c
2008-04-14 11:06:25.000000000 +0100
+++ gnome-control-center-2.22.1.new/capplets/display/xrandr-capplet.c
2008-04-14 12:12:43.000000000 +0100
@@ -303,6 +303,9 @@
     int width = rw_mode_get_width (mode);
     int height = rw_mode_get_height (mode);
 
+    if (!modes)
+        return FALSE;
+
     for (i = 0; modes[i] != NULL; ++i)
     {
 	RWMode *m = modes[i];
@@ -322,7 +325,7 @@
 {
     int i;
     GPtrArray *result;
-    RWMode **modes;
+    RWMode **modes = NULL;
 
     for (i = 0; config->outputs[i] != NULL; ++i)
     {




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