From: Stefan Weil Date: Thu, 19 Apr 2012 20:27:14 +0000 (+0200) Subject: qemu-char: Fix crash when switching consoles X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~4196 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ac3107340fbb9422ea63ee5d6729775965e121fd;p=sdk%2Femulator%2Fqemu.git qemu-char: Fix crash when switching consoles qemu-system-arm (and other system emulations) crashes with SDL when the user switches consoles (Alt-Ctrl-F4). We already check for NULL pointers in qemu_chr_fe_ioctl, qemu_chr_be_can_write and other functions, so do this also for s->chr_read in qemu_chr_be_write. This fixes the crash. Signed-off-by: Stefan Weil Signed-off-by: Anthony Liguori --- diff --git a/qemu-char.c b/qemu-char.c index 74c60e1..a9fc504 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -160,7 +160,9 @@ int qemu_chr_be_can_write(CharDriverState *s) void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len) { - s->chr_read(s->handler_opaque, buf, len); + if (s->chr_read) { + s->chr_read(s->handler_opaque, buf, len); + } } int qemu_chr_fe_get_msgfd(CharDriverState *s)