diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 2080b23..f80be0d 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -1903,7 +1903,9 @@ bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect) int o = -1, p; DisplayModePtr mode = NULL, test = NULL, match = NULL; - nextEnabledOutput(config, enabled, &o); + if (!nextEnabledOutput(config, enabled, &o)) + return NULL; + while ((mode = nextAspectMode(config->output[o], mode, aspect))) { test = mode; for (p = o; nextEnabledOutput(config, enabled, &p); ) {