From f9e7ae8a891666274ad9309b95fb2675a36a9305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 22 Nov 2019 21:52:12 +0100 Subject: [PATCH] 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. --- selection.c | 3 +++ 1 file changed, 3 insertions(+) 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))