From 8eb6a561ab9013d3ad12599176c077c57f12ce08 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Thu, 18 May 2000 22:28:38 +0000 Subject: Fixed e_card_name_copy and e_card_arbitrary_copy to deal correctly with a 2000-05-18 Christopher James Lahey * backend/ebook/e-card.c: Fixed e_card_name_copy and e_card_arbitrary_copy to deal correctly with a passed NULL. * contact-editor/Makefile.am: Removed imagesdir stuff. * contact-editor/arrow.png: Made this transparent. * contact-editor/contact-editor.glade, contact-editor/e-contact-editor-strings.h: Renamed some widgets and added custom widgets for all of the images. * contact-editor/e-contact-editor.c: Worked on making this work decently well with messed up glade files. Cleaned up a lot of code. svn path=/trunk/; revision=3121 --- addressbook/backend/ebook/e-card.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'addressbook/backend') diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c index eb453950da..b07723073f 100644 --- a/addressbook/backend/ebook/e-card.c +++ b/addressbook/backend/ebook/e-card.c @@ -1172,15 +1172,18 @@ e_card_name_free(ECardName *name) ECardName * e_card_name_copy(const ECardName *name) { - ECardName *newname = g_new(ECardName, 1); - - newname->prefix = g_strdup(name->prefix); - newname->given = g_strdup(name->given); - newname->additional = g_strdup(name->additional); - newname->family = g_strdup(name->family); - newname->suffix = g_strdup(name->suffix); + if (name) { + ECardName *newname = g_new(ECardName, 1); + + newname->prefix = g_strdup(name->prefix); + newname->given = g_strdup(name->given); + newname->additional = g_strdup(name->additional); + newname->family = g_strdup(name->family); + newname->suffix = g_strdup(name->suffix); - return newname; + return newname; + } else + return NULL; } char * @@ -1231,11 +1234,14 @@ e_card_arbitrary_new(void) ECardArbitrary * e_card_arbitrary_copy(const ECardArbitrary *arbitrary) { - ECardArbitrary *arb_copy = g_new(ECardArbitrary, 1); - arb_copy->key = g_strdup(arbitrary->key); - arb_copy->type = g_strdup(arbitrary->type); - arb_copy->value = g_strdup(arbitrary->value); - return arb_copy; + if (arbitrary) { + ECardArbitrary *arb_copy = g_new(ECardArbitrary, 1); + arb_copy->key = g_strdup(arbitrary->key); + arb_copy->type = g_strdup(arbitrary->type); + arb_copy->value = g_strdup(arbitrary->value); + return arb_copy; + } else + return NULL; } void -- cgit v1.2.3