summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgbert Eich <eich@freedesktop.org>2008-11-04 21:31:27 +0100
committerEgbert Eich <eich@freedesktop.org>2008-11-04 21:31:27 +0100
commit9a874a71a791c6110fd57b8a5c083f777a446d0f (patch)
treed5a1e256a73542bb37049afc75be1989e2eb0ea8
parenta4d62bbf215894bad8e19d99f7330c637d3d49e3 (diff)
DDX/RandR: When positioning outputs assume width/height = 0 if no modes exist.
When a user specifies the position of an output for which no modes exist (for whatever reason) assume that the width and height of this output is 0. The result will be the same as if this output isn't taken into consideration at all and thus should be sane. It will prevent a segfault when trying to determine the width and height of a non-existent mode.
-rw-r--r--hw/xfree86/modes/xf86Crtc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index df47598aa..f072109de 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1185,10 +1185,12 @@ xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
output->initial_x += xf86ModeWidth (modes[or], relative->initial_rotation);
break;
case OPTION_ABOVE:
- output->initial_y -= xf86ModeHeight (modes[o], output->initial_rotation);
+ if (modes[o])
+ output->initial_y -= xf86ModeHeight (modes[o], output->initial_rotation);
break;
case OPTION_LEFT_OF:
- output->initial_x -= xf86ModeWidth (modes[o], output->initial_rotation);
+ if (modes[o])
+ output->initial_x -= xf86ModeWidth (modes[o], output->initial_rotation);
break;
default:
break;