diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2025-06-09 07:12:08 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2025-06-10 05:12:53 +0000 |
| commit | 499f019deaf6e7b7e7bb6bbb43b93a7296d9b4fe (patch) | |
| tree | 78f4b1b4e1cd3b169a137dcf329e1e37b6d31a79 /osc.c | |
| parent | main: 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.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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; } |
