Mercurial > pidgin
changeset 14670:11fd4148f9da
[gaim-migrate @ 17416]
Don't dereference things before we check if they are NULL
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sun, 01 Oct 2006 15:14:05 +0000 |
parents | 9d669dc232ad |
children | d347b09626ee |
files | libgaim/blist.c |
diffstat | 1 files changed, 15 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libgaim/blist.c Sun Oct 01 15:11:55 2006 +0000 +++ b/libgaim/blist.c Sun Oct 01 15:14:05 2006 +0000 @@ -839,11 +839,13 @@ { GaimBlistUiOps *ops = gaim_blist_get_ui_ops(); GaimConversation *conv; - char *old_alias = contact->alias; GaimBlistNode *bnode; + char *old_alias; g_return_if_fail(contact != NULL); + old_alias = contact->alias; + if ((alias != NULL) && (*alias != '\0')) contact->alias = g_strdup(alias); else @@ -872,10 +874,12 @@ void gaim_blist_alias_chat(GaimChat *chat, const char *alias) { GaimBlistUiOps *ops = gaim_blist_get_ui_ops(); - char *old_alias = chat->alias; + char *old_alias; g_return_if_fail(chat != NULL); + old_alias = chat->alias; + if ((alias != NULL) && (*alias != '\0')) chat->alias = g_strdup(alias); else @@ -895,10 +899,12 @@ { GaimBlistUiOps *ops = gaim_blist_get_ui_ops(); GaimConversation *conv; - char *old_alias = buddy->alias; + char *old_alias; g_return_if_fail(buddy != NULL); + old_alias = buddy->alias; + if ((alias != NULL) && (*alias != '\0')) buddy->alias = g_strdup(alias); else @@ -923,10 +929,12 @@ { GaimBlistUiOps *ops = gaim_blist_get_ui_ops(); GaimConversation *conv; - char *old_alias = buddy->server_alias; + char *old_alias; g_return_if_fail(buddy != NULL); + old_alias = buddy->server_alias; + if ((alias != NULL) && (*alias != '\0') && g_utf8_validate(alias, -1, NULL)) buddy->server_alias = g_strdup(alias); else @@ -1404,10 +1412,12 @@ void gaim_contact_set_alias(GaimContact *contact, const char *alias) { GaimBlistUiOps *ops = gaim_blist_get_ui_ops(); - char *old_alias = contact->alias; + char *old_alias; g_return_if_fail(contact != NULL); + old_alias = contact->alias; + if ((alias != NULL) && (*alias != '\0')) contact->alias = g_strdup(alias); else