From: Pierre Ossman Date: Thu, 9 Feb 2023 10:30:37 +0000 (+0100) Subject: Sanity check when cleaning up keymap changes X-Git-Tag: v1.13.90~92 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1e3484f2017f038dd5149cd50741feaf39a680e4;p=tigervnc.git Sanity check when cleaning up keymap changes Make sure we don't send a bogus request to the X server in the (common) case that we don't actually have anything to restore. --- diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx index 5f5366b7..19517929 100644 --- a/unix/x0vncserver/XDesktop.cxx +++ b/unix/x0vncserver/XDesktop.cxx @@ -481,6 +481,10 @@ void XDesktop::deleteAddedKeysyms(Display* dpy) { } } + // Did we actually find something to remove? + if (highestKeyCode < lowestKeyCode) + return; + changes.changed |= XkbKeySymsMask; changes.first_key_sym = lowestKeyCode; changes.num_key_syms = highestKeyCode - lowestKeyCode + 1;