From: Stefan Weil Date: Fri, 17 Aug 2012 13:50:44 +0000 (+0200) Subject: console: Fix warning from clang (and potential crash) X-Git-Tag: v1.2.0-rc3~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8bd6b06d7b718b3e595aab279699ef3651ce2e48;p=thirdparty%2Fqemu.git console: Fix warning from clang (and potential crash) ccc-analyzer reports this warning: console.c:1090:29: warning: Dereference of null pointer if (active_console->cursor_timer) { ^ Function console_select allows active_console to be NULL, but would crash when accessing cursor_timer. Fix this. Reviewed-by: Jan Kiszka Signed-off-by: Stefan Weil Signed-off-by: Anthony Liguori --- diff --git a/console.c b/console.c index 4525cc70b87..f5e88147926 100644 --- a/console.c +++ b/console.c @@ -1087,7 +1087,7 @@ void console_select(unsigned int index) if (s) { DisplayState *ds = s->ds; - if (active_console->cursor_timer) { + if (active_console && active_console->cursor_timer) { qemu_del_timer(active_console->cursor_timer); } active_console = s;