aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook
diff options
context:
space:
mode:
authorMatt Bissiri <bissiri@eecs.umich.edu>2000-09-27 04:31:38 +0800
committerChris Lahey <clahey@src.gnome.org>2000-09-27 04:31:38 +0800
commit47db07dee8c848e2fb56766e812753f74a5c0926 (patch)
treece94b05b29c03b26a794e1f39b7768d37ec960f2 /addressbook/backend/ebook
parenta03e2e75297c4d1b99890cdc90c3443088eb7ce8 (diff)
downloadgsoc2013-evolution-47db07dee8c848e2fb56766e812753f74a5c0926.tar
gsoc2013-evolution-47db07dee8c848e2fb56766e812753f74a5c0926.tar.gz
gsoc2013-evolution-47db07dee8c848e2fb56766e812753f74a5c0926.tar.bz2
gsoc2013-evolution-47db07dee8c848e2fb56766e812753f74a5c0926.tar.lz
gsoc2013-evolution-47db07dee8c848e2fb56766e812753f74a5c0926.tar.xz
gsoc2013-evolution-47db07dee8c848e2fb56766e812753f74a5c0926.tar.zst
gsoc2013-evolution-47db07dee8c848e2fb56766e812753f74a5c0926.zip
Make sure that card->name and card->full_name are always valid.
Tue Sep 26 16:28:47 2000 Christopher James Lahey <clahey@helixcode.com> * backend/ebook/e-card.c: Make sure that card->name and card->full_name are always valid. * contact-editor/e-contact-editor.c: Removed some unused variables. 2000-09-22 Matt Bissiri <bissiri@eecs.umich.edu> * contact-editor/e-contact-editor-fullname.c (extract_info): If (editor->name == NULL), store ptr to newly allocated ECardName in editor->name, not just in a stack variable. This fixes a crash which happened when you click "New", then click "Full Name...", then enter name, then click "OK". * backend/ebook/e-card.c (e_card_name_to_string): Add g_return_val_if_fail. svn path=/trunk/; revision=5596
Diffstat (limited to 'addressbook/backend/ebook')
-rw-r--r--addressbook/backend/ebook/e-card.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c
index 528465f439..940bfd84d5 100644
--- a/addressbook/backend/ebook/e-card.c
+++ b/addressbook/backend/ebook/e-card.c
@@ -951,26 +951,24 @@ parse(ECard *card, VObject *vobj)
while(moreIteration (&iterator)) {
parse_attribute(card, nextVObject(&iterator));
}
+ if (!card->fname) {
+ card->fname = g_strdup("");
+ }
if (!card->name) {
- if (card->fname) {
- card->name = e_card_name_from_string(card->fname);
- }
+ card->name = e_card_name_from_string(card->fname);
}
if (!card->file_as) {
- if (card->name) {
- ECardName *name = card->name;
- char *strings[3], **stringptr;
- char *string;
- stringptr = strings;
- if (name->family && *name->family)
- *(stringptr++) = name->family;
- if (name->given && *name->given)
- *(stringptr++) = name->given;
- *stringptr = NULL;
- string = g_strjoinv(", ", strings);
- card->file_as = string;
- } else
- card->file_as = g_strdup("");
+ ECardName *name = card->name;
+ char *strings[3], **stringptr;
+ char *string;
+ stringptr = strings;
+ if (name->family && *name->family)
+ *(stringptr++) = name->family;
+ if (name->given && *name->given)
+ *(stringptr++) = name->given;
+ *stringptr = NULL;
+ string = g_strjoinv(", ", strings);
+ card->file_as = string;
}
}
@@ -1299,6 +1297,9 @@ char *
e_card_name_to_string(const ECardName *name)
{
char *strings[6], **stringptr = strings;
+
+ g_return_val_if_fail (name != NULL, NULL);
+
if (name->prefix && *name->prefix)
*(stringptr++) = name->prefix;
if (name->given && *name->given)