From 9253d877a2b1e774dbd67e0aa893e880a2abd5c0 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Mon, 14 Mar 2016 20:05:45 -0700 Subject: [PATCH] GUAC-1389: Do not handle input events until terminal exists. --- src/protocols/telnet/input.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/protocols/telnet/input.c b/src/protocols/telnet/input.c index 2f73aba3..f73e836a 100644 --- a/src/protocols/telnet/input.c +++ b/src/protocols/telnet/input.c @@ -41,6 +41,10 @@ int guac_telnet_user_mouse_handler(guac_user* user, int x, int y, int mask) { guac_telnet_settings* settings = telnet_client->settings; guac_terminal* term = telnet_client->term; + /* Skip if terminal not yet ready */ + if (term == NULL) + return 0; + /* Send mouse if not searching for password or username */ if (settings->password_regex == NULL && settings->username_regex == NULL) guac_terminal_send_mouse(term, user, x, y, mask); @@ -56,6 +60,10 @@ int guac_telnet_user_key_handler(guac_user* user, int keysym, int pressed) { guac_telnet_settings* settings = telnet_client->settings; guac_terminal* term = telnet_client->term; + /* Skip if terminal not yet ready */ + if (term == NULL) + return 0; + /* Stop searching for password */ if (settings->password_regex != NULL) { @@ -107,6 +115,10 @@ int guac_telnet_user_size_handler(guac_user* user, int width, int height) { guac_telnet_client* telnet_client = (guac_telnet_client*) client->data; guac_terminal* terminal = telnet_client->term; + /* Skip if terminal not yet ready */ + if (terminal == NULL) + return 0; + /* Resize terminal */ guac_terminal_resize(terminal, width, height);