From 4097daba7e43b3a1a3af77a715da1a2418d30392 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 16 Mar 2014 18:13:58 +0100 Subject: Fix crash on opening /dev/kbd or mouse without any console being active * console-client/console.c (console_switch_away): Check for `active_vcons` being NULL before saving the currently active console. --- console-client/console.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'console-client') diff --git a/console-client/console.c b/console-client/console.c index 2fb2fbeb..2fa05339 100644 --- a/console-client/console.c +++ b/console-client/console.c @@ -226,10 +226,17 @@ console_switch_away (void) if (driver->ops->save_status) driver->ops->save_status (driver->handle); - saved_id = active_vcons->id; - saved_cons = active_vcons->cons; - cons_vcons_close (active_vcons); - active_vcons = NULL; + if (active_vcons) + { + saved_id = active_vcons->id; + saved_cons = active_vcons->cons; + cons_vcons_close (active_vcons); + active_vcons = NULL; + } + else + { + saved_cons = NULL; + } pthread_mutex_unlock (&global_lock); } -- cgit v1.2.3