diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2021-06-20 13:16:29 +0200 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2021-07-05 22:20:07 +0200 |
commit | 9874023096b1940ef3df0756a0ec81d5d57e09c2 (patch) | |
tree | 8383ca6b3eabf6e3764ae205e5adc08b4fd68151 /nx-X11 | |
parent | 5da2be394a3961c7a6d96a3e117ffc434fe34827 (diff) | |
download | nx-libs-9874023096b1940ef3df0756a0ec81d5d57e09c2.tar.gz nx-libs-9874023096b1940ef3df0756a0ec81d5d57e09c2.tar.bz2 nx-libs-9874023096b1940ef3df0756a0ec81d5d57e09c2.zip |
Clipboard.c: check for invalid index
We only need to check this in
nxagentHandleSelectionClearFromXServerByIndex, so we can simplify
nxagentHandleSelectionClearFromXServerByAtom.
Diffstat (limited to 'nx-X11')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 4a0bf9cb5..3b08c1133 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -882,6 +882,14 @@ void nxagentHandleSelectionClearFromXServerByIndex(int index) fprintf(stderr, "%s: SelectionClear event for selection index [%u].\n", __func__, index); #endif + if (index == -1) + { + #ifdef DEBUG + fprintf(stderr, "%s: ignoring index -1 - doing nothing.\n", __func__); + #endif + return; + } + if (!agentClipboardInitialized) { #ifdef DEBUG @@ -931,11 +939,7 @@ void nxagentHandleSelectionClearFromXServerByAtom(XlibAtom sel) fprintf(stderr, "---------\n%s: SelectionClear event for remote selection atom [%lu][%s].\n", __func__, sel, NameForRemoteAtom(sel)); #endif - int index = nxagentFindRemoteSelectionIndex(sel); - if (index != -1) - { - nxagentHandleSelectionClearFromXServerByIndex(index); - } + nxagentHandleSelectionClearFromXServerByIndex(nxagentFindRemoteSelectionIndex(sel)); } void nxagentHandleSelectionClearFromXServer(XEvent *X) |