aboutsummaryrefslogtreecommitdiff
path: root/console.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2011-11-18 16:41:59 +0100
committerAlexander Graf <agraf@suse.de>2012-01-03 02:49:25 +0100
commit33bcd98c4e9fe0866807bef6253a057c82087539 (patch)
tree86d7a72616d61ef47e8e49de7d96750e88f3878c /console.c
parent4e9200a0a0f89ad2b26f6aa42e1fca16b364a8c8 (diff)
console: Fix segfault on screendump without VGA adapter
When trying to create a screen dump without having any VGA adapter inside the guest, QEMU segfaults. This is because it's trying to switch back to the "previous" screen it was on before dumping the VGA screen. Unfortunately, in my case there simply is no previous screen so it accesses a NULL pointer. Fix it by checking if previous_active_console is actually available. This is 1.0 material. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'console.c')
-rw-r--r--console.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/console.c b/console.c
index 223f8fd9a4..135394f6f6 100644
--- a/console.c
+++ b/console.c
@@ -186,7 +186,9 @@ void vga_hw_screen_dump(const char *filename)
consoles[0]->hw_screen_dump(consoles[0]->hw, filename);
}
- console_select(previous_active_console->index);
+ if (previous_active_console) {
+ console_select(previous_active_console->index);
+ }
}
void vga_hw_text_update(console_ch_t *chardata)