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.
This commit is contained in:
Daniel Eklöf 2019-11-22 21:52:12 +01:00
parent da92abef31
commit f9e7ae8a89
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -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))