]> git.proxmox.com Git - qemu.git/commitdiff
Fix segfault on screendump with -nographic
authorAlexander Graf <agraf@suse.de>
Thu, 26 May 2011 21:50:33 +0000 (23:50 +0200)
committerAlexander Graf <agraf@suse.de>
Fri, 3 Jun 2011 10:42:19 +0000 (12:42 +0200)
When running -nographic and calling "screendump" on the monitor, qemu
segfaults. Fix the invalid pointer dereference by checking for NULL.

Signed-off-by: Alexander Graf <agraf@suse.de>
console.c

index 871c1d47b2d29a442436f595c3ed2b6fb04f316c..9c6addf8e44aa603b6f5c111637978e3f511ab29 100644 (file)
--- a/console.c
+++ b/console.c
@@ -180,7 +180,7 @@ void vga_hw_screen_dump(const char *filename)
     active_console = consoles[0];
     /* There is currently no way of specifying which screen we want to dump,
        so always dump the first one.  */
-    if (consoles[0]->hw_screen_dump)
+    if (consoles[0] && consoles[0]->hw_screen_dump)
         consoles[0]->hw_screen_dump(consoles[0]->hw, filename);
     active_console = previous_active_console;
 }