diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-11-22 20:52:12 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-11-22 20:55:47 +0000 |
| commit | f9e7ae8a891666274ad9309b95fb2675a36a9305 (patch) | |
| tree | 53a95225d846b43034ba90bbf711bcd1cf45f11d /selection.c | |
| parent | selection: we already have a direct pointer to the clipboard struct (diff) | |
selection: selection_to_clipboard: exit early on no-selection
When there's no selection, exit early to avoid trying to get grid data
from row -1.
Diffstat (limited to 'selection.c')
| -rw-r--r-- | selection.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/selection.c b/selection.c index de7962ae..66d848c6 100644 --- a/selection.c +++ b/selection.c @@ -564,6 +564,9 @@ text_to_clipboard(struct terminal *term, char *text, uint32_t serial) void selection_to_clipboard(struct terminal *term, uint32_t serial) { + if (term->selection.start.row == -1 || term->selection.end.row == -1) + return; + /* Get selection as a string */ char *text = extract_selection(term); if (!text_to_clipboard(term, text, serial)) |
