summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2008-03-07 08:29:49 -0500
committerAdam Jackson <ajax@redhat.com>2008-03-07 08:30:19 -0500
commit3fcb6445dc08f42488287162e3b7009d405e9c5b (patch)
tree00350d81ec5089439352995d4b59cc8c39de3b75
parenta8d760f567b19268329c4682495caa591f08a854 (diff)
Fix segfault when a monitor exists but has no modes.
Thanks to Zhenyu Wang for finding this.
-rw-r--r--hw/xfree86/modes/xf86Crtc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 4d5d7b848..0bef5b42f 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1678,6 +1678,9 @@ nextAspectMode(DisplayModePtr start, float aspect)
{
DisplayModePtr m = start;
+ if (!m)
+ return NULL;
+
for (m = m->next; m; m = m->next)
if (aspectMatch(aspect, (float)m->HDisplay / (float)m->VDisplay))
return m;