changeset 14936:5025e146a876

[gaim-migrate @ 17708] Fix crash when account doesn't have an alias. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 09 Nov 2006 04:49:54 +0000
parents ef80d4c30a90
children 762896fc8449
files libgaim/plugins/log_reader.c
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/plugins/log_reader.c	Thu Nov 09 00:20:18 2006 +0000
+++ b/libgaim/plugins/log_reader.c	Thu Nov 09 04:49:54 2006 +0000
@@ -848,7 +848,7 @@
 
 			if (friendly_name != NULL) {
 				int friendly_name_length = strlen(friendly_name);
-				int alias_length         = strlen(log->account->alias);
+				int alias_length         = log->account->alias ? strlen(log->account->alias) : 0;
 				GaimBuddy *buddy = gaim_find_buddy(log->account, log->name);
 				gboolean from_name_matches;
 				gboolean to_name_matches;
@@ -972,8 +972,12 @@
 		if (from_name) {
 			text = g_string_append(text, "<b>");
 
-			if (name_guessed == NAME_GUESS_ME)
-				text = g_string_append(text, log->account->alias);
+			if (name_guessed == NAME_GUESS_ME) {
+				if (log->account->alias)
+					text = g_string_append(text, log->account->alias);
+				else
+					text = g_string_append(text, log->account->username);
+			}
 			else if (name_guessed == NAME_GUESS_THEM)
 				text = g_string_append(text, their_name);
 			else
@@ -1500,11 +1504,16 @@
 					while (*line2 && *line2 != ':')
 						line2++;
 					if (*line2 == ':') {
+						char *acct_name;
 						line2++;
 						line = line2;
+						acct_name = gaim_account_get_alias(log->account);
+						if (!acct_name)
+							acct_name = gaim_account_get_username(log->account);
+
 						g_string_append_printf(formatted,
 							"<span style=\"color: #16569E;\">"
-							"<b>%s</b></span>:", log->account->alias);
+							"<b>%s</b></span>:", acct_name);
 					}
 				}
 			}