Index: gdk/x11/gdkscreen-x11.c
===================================================================
--- gdk/x11/gdkscreen-x11.c	(revision 21840)
+++ gdk/x11/gdkscreen-x11.c	(working copy)
@@ -385,7 +385,8 @@
 gdk_screen_get_monitor_width_mm	(GdkScreen *screen,
 				 gint       monitor_num)
 {
-  return get_monitor (screen, monitor_num)->width_mm;
+  GdkX11Monitor *monitor = get_monitor (screen, monitor_num);
+  return monitor ? monitor->width_mm : 0;
 }
 
 /**
@@ -403,7 +404,8 @@
 gdk_screen_get_monitor_height_mm (GdkScreen *screen,
                                   gint       monitor_num)
 {
-  return get_monitor (screen, monitor_num)->height_mm;
+  GdkX11Monitor *monitor = get_monitor (screen, monitor_num);
+  return monitor ? monitor->height_mm : 0;
 }
 
 /**
@@ -424,7 +426,8 @@
 gdk_screen_get_monitor_plug_name (GdkScreen *screen,
 				  gint       monitor_num)
 {
-  return g_strdup (get_monitor (screen, monitor_num)->output_name);
+  GdkX11Monitor *monitor = get_monitor (screen, monitor_num);
+  return monitor ? g_strdup (monitor->output_name) : NULL;
 }
 
 /**
@@ -444,7 +447,8 @@
 gdk_x11_screen_get_monitor_output (GdkScreen *screen,
                                    gint       monitor_num)
 {
-  return get_monitor (screen, monitor_num)->output;
+  GdkX11Monitor *monitor = get_monitor (screen, monitor_num);
+  return monitor ? monitor->output : 0;
 }
 
 /**
@@ -470,7 +474,8 @@
     {
       GdkX11Monitor *monitor = get_monitor (screen, monitor_num);
 
-      *dest = monitor->geometry;
+      if (monitor)
+	*dest = monitor->geometry;
     }
 }
 
