]> source.dussan.org Git - tigervnc.git/commitdiff
Sanity check when cleaning up keymap changes
authorPierre Ossman <ossman@cendio.se>
Thu, 9 Feb 2023 10:30:37 +0000 (11:30 +0100)
committerPierre Ossman <ossman@cendio.se>
Thu, 9 Feb 2023 10:30:37 +0000 (11:30 +0100)
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.

unix/x0vncserver/XDesktop.cxx

index 5f5366b7e24535b2d6812ab24222460d805d3e63..19517929c2ced650d5e10657c3ff049adf4e2d1d 100644 (file)
@@ -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;