From 3bc2a43bef9b0842cb242dd19853d0344c8a2766 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Fri, 1 Dec 2017 20:50:14 +0100 Subject: [PATCH] Check if there is an selection when opening selection Prevent a segfault when trying to open a selection, when there is no selection. --- termite.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/termite.cc b/termite.cc index ba1fc30..da65439 100644 --- a/termite.cc +++ b/termite.cc @@ -564,6 +564,11 @@ static void move_to_row_start(VteTerminal *vte, select_info *select, long row) { } static void open_selection(char *browser, VteTerminal *vte) { + if (!vte_terminal_get_has_selection(vte)) { + g_printerr("no selection to open\n"); + return; + } + if (browser) { auto selection = make_unique(vte_terminal_get_selection(vte), g_free); if (selection && *selection) {