From: Alexander Graf Date: Fri, 18 Nov 2011 15:41:59 +0000 (+0100) Subject: console: Fix segfault on screendump without VGA adapter X-Git-Tag: TizenStudio_2.0_p2.3~1866^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=43d032be8fa811aa6eed9bb125e88ffd06478435;p=sdk%2Femulator%2Fqemu.git 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 --- diff --git a/console.c b/console.c index f6fe441..ed6a653 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)