aboutsummaryrefslogtreecommitdiff
path: root/osc.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2025-06-09 07:12:08 +0000
committerDaniel Eklöf <daniel@ekloef.se>2025-06-10 05:12:53 +0000
commit499f019deaf6e7b7e7bb6bbb43b93a7296d9b4fe (patch)
tree78f4b1b4e1cd3b169a137dcf329e1e37b6d31a79 /osc.c
parentmain: do a theme toggle upon receiving SIGUSR1 (diff)
osc: 52: clear selection if the payload is the empty string
Diffstat (limited to 'osc.c')
-rw-r--r--osc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/osc.c b/osc.c
index d59adc5a..834029c1 100644
--- a/osc.c
+++ b/osc.c
@@ -73,16 +73,19 @@ osc_to_clipboard(struct terminal *term, const char *target,
}
char *decoded = base64_decode(base64_data, NULL);
- if (decoded == NULL) {
- if (errno == EINVAL)
- LOG_WARN("OSC: invalid clipboard data: %s", base64_data);
- else
- LOG_ERRNO("base64_decode() failed");
+ if (decoded == NULL || decoded[0] == '\0') {
+ if (decoded == NULL) {
+ if (errno == EINVAL)
+ LOG_WARN("OSC: invalid clipboard data: %s", base64_data);
+ else
+ LOG_ERRNO("base64_decode() failed");
+ }
if (to_clipboard)
selection_clipboard_unset(seat);
if (to_primary)
selection_primary_unset(seat);
+ free(decoded);
return;
}