# HG changeset patch # User Richard Laager # Date 1164000812 0 # Node ID c6fd017c4121f225eaffd98d944e00bb6d37bb70 # Parent 7589733ba1aa37babaf4898ad540df87fe8af3bc [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." committer: Tailor Script diff -r 7589733ba1aa -r c6fd017c4121 COPYRIGHT --- 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 Rob Foehl (rwf) diff -r 7589733ba1aa -r c6fd017c4121 libgaim/plugins/log_reader.c --- 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) {