From ba82a3e63bfefcccef560155fbafc1f2d8a66bc2 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <michael@stapelberg.de>
Date: Wed, 23 Dec 2009 00:39:03 +0100
Subject: [PATCH] Bugfix: Fix NULL pointer dereference in workspaces which have
 preferred screens but were not used yet (Thanks badboy)

---
 src/xinerama.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/xinerama.c b/src/xinerama.c
index 81359ec2..15e8b0a3 100644
--- a/src/xinerama.c
+++ b/src/xinerama.c
@@ -425,7 +425,7 @@ void xinerama_requery_screens(xcb_connection_t *conn) {
         /* Check for workspaces which need to be assigned to specific screens
          * which may now be available */
         TAILQ_FOREACH(ws, workspaces, workspaces) {
-                if (ws->preferred_screen == NULL)
+                if (ws->preferred_screen == NULL || ws->screen == NULL)
                         continue;
 
                 workspace_initialize(ws, ws->screen, true);