From 4e4bbb85499cff052ce03e173b88f1083ba83f86 Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Mon, 14 Jun 2010 13:45:08 +0300 Subject: XRRUpdateConfiguration: Check if getting screen for root fails XRRRootToScreen might return -1 if it fails to find screen for the root window. Following code uses screen number unconditionally to index the screen array. Signed-off-by: Pauli Nieminen Reviewed-by: Alan Coopersmith Signed-off-by: Alan Coopersmith --- src/Xrandr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Xrandr.c b/src/Xrandr.c index b1e97ec..a9fba87 100644 --- a/src/Xrandr.c +++ b/src/Xrandr.c @@ -483,6 +483,9 @@ int XRRUpdateConfiguration(XEvent *event) scevent = (XRRScreenChangeNotifyEvent *) event; snum = XRRRootToScreen(dpy, ((XRRScreenChangeNotifyEvent *) event)->root); + if (snum < 0) + return 0; + if (scevent->rotation & (RR_Rotate_90 | RR_Rotate_270)) { dpy->screens[snum].width = scevent->height; dpy->screens[snum].height = scevent->width; -- cgit v1.2.3