[gaim-migrate @ 17790]

Mon, 20 Nov 2006 05:33:32 +0000

author
Richard Laager <rlaager@pidgin.im>
date
Mon, 20 Nov 2006 05:33:32 +0000
changeset 15071
f7927e8ce744
parent 15070
9f16d253a3c3
child 15072
ee6e0cceb117

[gaim-migrate @ 17790]
Part of SF Patch #1599432 from Leonardo Fernandes

"This patch ... solves a check for NULL that produced an error in the
debug console."

COPYRIGHT file | annotate | diff | comparison | revisions
libgaim/plugins/log_reader.c file | annotate | diff | comparison | revisions
--- a/COPYRIGHT	Mon Nov 20 04:05:33 2006 +0000
+++ b/COPYRIGHT	Mon Nov 20 05:33:32 2006 +0000
@@ -103,6 +103,7 @@
 Gábor Farkas
 Jesse Farmer
 Gavan Fantom (gavan)
+Leonardo Fernandes
 David Fiander
 Rob Flynn <gaim@robflynn.com>
 Rob Foehl (rwf)
--- a/libgaim/plugins/log_reader.c	Mon Nov 20 04:05:33 2006 +0000
+++ b/libgaim/plugins/log_reader.c	Mon Nov 20 05:33:32 2006 +0000
@@ -973,7 +973,8 @@
 
 			if (friendly_name != NULL) {
 				int friendly_name_length = strlen(friendly_name);
-				int alias_length         = log->account->alias ? strlen(log->account->alias) : 0;
+				const char *alias;
+				int alias_length;
 				GaimBuddy *buddy = gaim_find_buddy(log->account, log->name);
 				gboolean from_name_matches;
 				gboolean to_name_matches;
@@ -981,6 +982,17 @@
 				if (buddy && buddy->alias)
 					their_name = buddy->alias;
 
+				if (log->account->alias)
+				{
+					alias = log->account->alias;
+					alias_length = strlen(alias);
+				}
+				else
+				{
+					alias = "";
+					alias_length = 0;
+				}
+
 				/* Try to guess which user is me.
 				 * The first step is to determine if either of the names matches either my
 				 * friendly name or alias. For this test, "match" is defined as:
@@ -988,13 +1000,13 @@
 				 */
 				from_name_matches = (gaim_str_has_prefix(from_name, friendly_name) &&
 				                      !isalnum(*(from_name + friendly_name_length))) ||
-				                     (gaim_str_has_prefix(from_name, log->account->alias) &&
+				                     (gaim_str_has_prefix(from_name, alias) &&
 				                      !isalnum(*(from_name + alias_length)));
 
 				to_name_matches = to_name != NULL && (
 				                   (gaim_str_has_prefix(to_name, friendly_name) &&
 				                    !isalnum(*(to_name + friendly_name_length))) ||
-				                   (gaim_str_has_prefix(to_name, log->account->alias) &&
+				                   (gaim_str_has_prefix(to_name, alias) &&
 				                    !isalnum(*(to_name + alias_length))));
 
 				if (from_name_matches) {

mercurial