aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-11-22 20:52:12 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-11-22 20:55:47 +0000
commitf9e7ae8a891666274ad9309b95fb2675a36a9305 (patch)
tree53a95225d846b43034ba90bbf711bcd1cf45f11d
parentselection: 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.
-rw-r--r--selection.c3
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))