summary refs log tree commit diff stats
path: root/src/fe-gtk
diff options
context:
space:
mode:
authorTingPing <tngpng@gmail.com>2013-04-15 13:54:00 -0700
committerTingPing <tngpng@gmail.com>2013-04-15 13:54:00 -0700
commit86564c8741b78abe16163bd0d36a90385218334c (patch)
tree12d91c3d9f5c72a4616eb60f97eccc2148abd1a3 /src/fe-gtk
parentf0d0f90e13d563ce0c014a3de5406c93f18af74e (diff)
parenta5eb7784c654abc42bfdba0fcf21602b5842b256 (diff)
Merge pull request #545 from RichardHitt/issue522
Fix broken logic in mg_word_clicked().  fixes #522
Diffstat (limited to 'src/fe-gtk')
-rw-r--r--src/fe-gtk/maingui.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c
index e8479904..fb225f47 100644
--- a/src/fe-gtk/maingui.c
+++ b/src/fe-gtk/maingui.c
@@ -2236,25 +2236,28 @@ mg_word_clicked (GtkWidget *xtext, char *word, GdkEventButton *even)
 	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;
 	}
@@ -2267,6 +2270,8 @@ mg_word_clicked (GtkWidget *xtext, char *word, GdkEventButton *even)
 			userlist_select (sess, word);
 		return;
 	}
+	if (word == NULL)
+		return;
 
 	switch (word_type)
 	{