GUACAMOLE-306: Do not attempt to send VNC events with a non-existent VNC client object.

This commit is contained in:
Michael Jumper 2017-05-19 14:05:03 -07:00
parent 0e5498fc83
commit 8024f13458
2 changed files with 11 additions and 4 deletions

View File

@ -113,8 +113,9 @@ int guac_vnc_clipboard_end_handler(guac_user* user, guac_stream* stream) {
guac_iconv(GUAC_READ_UTF8, &input, vnc_client->clipboard->length,
writer, &output, sizeof(output_data));
/* Send via VNC */
SendClientCutText(rfb_client, output_data, output - output_data);
/* Send via VNC only if finished connecting */
if (rfb_client != NULL)
SendClientCutText(rfb_client, output_data, output - output_data);
return 0;
}

View File

@ -30,11 +30,14 @@ int guac_vnc_user_mouse_handler(guac_user* user, int x, int y, int mask) {
guac_client* client = user->client;
guac_vnc_client* vnc_client = (guac_vnc_client*) client->data;
rfbClient* rfb_client = vnc_client->rfb_client;
/* Store current mouse location */
guac_common_cursor_move(vnc_client->display->cursor, user, x, y);
SendPointerEvent(vnc_client->rfb_client, x, y, mask);
/* Send VNC event only if finished connecting */
if (rfb_client != NULL)
SendPointerEvent(rfb_client, x, y, mask);
return 0;
}
@ -42,8 +45,11 @@ int guac_vnc_user_mouse_handler(guac_user* user, int x, int y, int mask) {
int guac_vnc_user_key_handler(guac_user* user, int keysym, int pressed) {
guac_vnc_client* vnc_client = (guac_vnc_client*) user->client->data;
rfbClient* rfb_client = vnc_client->rfb_client;
SendKeyEvent(vnc_client->rfb_client, keysym, pressed);
/* Send VNC event only if finished connecting */
if (rfb_client != NULL)
SendKeyEvent(rfb_client, keysym, pressed);
return 0;
}