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.
This commit is contained in:
Egbert Eich 2008-11-04 21:31:27 +01:00
parent a4d62bbf21
commit 9a874a71a7

View File

@ -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;