Check if there is an selection when opening selection

Prevent a segfault when trying to open a selection, when there is no
selection.
This commit is contained in:
Jelle van der Waa 2017-12-01 20:50:14 +01:00
parent 9eda6c5913
commit 3bc2a43bef
1 changed files with 5 additions and 0 deletions

View File

@ -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) { 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) { if (browser) {
auto selection = make_unique(vte_terminal_get_selection(vte), g_free); auto selection = make_unique(vte_terminal_get_selection(vte), g_free);
if (selection && *selection) { if (selection && *selection) {