From a5eb7784c654abc42bfdba0fcf21602b5842b256 Mon Sep 17 00:00:00 2001 From: RichardHitt Date: Mon, 15 Apr 2013 12:05:53 -0700 Subject: [PATCH] Fix broken logic in mg_word_clicked(). fixes #522 --- src/fe-gtk/maingui.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index e847990..fb225f4 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -2263,25 +2263,28 @@ int word_type, start, end; char *tmp; - if (word == NULL) + if (word) { - if (even->button == 1) /* left button */ - mg_focus (sess); - return; + word_type = mg_word_check (xtext, word); + url_last (&start, &end); } - word_type = mg_word_check (xtext, word); - url_last (&start, &end); - - if (even->button == 1 && (even->state & 13) == prefs.hex_gui_url_mod) + if (even->button == 1) /* left button */ { - switch (word_type) + if (word == NULL) { - case WORD_URL: - case WORD_HOST: - word[end] = 0; - word += start; - fe_open_url (word); + mg_focus (sess); + return; + } + + if ((even->state & 13) == prefs.hex_gui_url_mod) + { + switch (word_type) + { + case WORD_URL: + case WORD_HOST: + fe_open_url (word); + } } return; } @@ -2294,6 +2297,8 @@ userlist_select (sess, word); return; } + if (word == NULL) + return; switch (word_type) { -- 1.8.1.6