From a455eb6481393613087e660373057bc03af8d779 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Sat, 3 Nov 2001 05:32:40 +0000 Subject: Check for NULL dates before converting them to strings. Fixes Ximian bug 2001-11-02 Christopher James Lahey * backend/ebook/e-card-simple.c (e_card_simple_get): Check for NULL dates before converting them to strings. Fixes Ximian bug #14394. svn path=/trunk/; revision=14579 --- addressbook/backend/ebook/e-card-simple.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'addressbook/backend') diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c index b1f54ffd03..0af55bc8d9 100644 --- a/addressbook/backend/ebook/e-card-simple.c +++ b/addressbook/backend/ebook/e-card-simple.c @@ -773,19 +773,23 @@ char *e_card_simple_get (ECardSimple *simple, return NULL; case E_CARD_SIMPLE_INTERNAL_TYPE_DATE: if (simple->card) { - char buf[26]; - struct tm then; gtk_object_get(GTK_OBJECT(simple->card), field_data[field].ecard_field, &date, NULL); - then.tm_year = date->year; - then.tm_mon = date->month - 1; - then.tm_mday = date->day; - then.tm_hour = 12; - then.tm_min = 0; - then.tm_sec = 0; - e_strftime_fix_am_pm (buf, 26, _("%x"), &then); - return g_strdup (buf); + if (date != NULL) { + char buf[26]; + struct tm then; + then.tm_year = date->year; + then.tm_mon = date->month - 1; + then.tm_mday = date->day; + then.tm_hour = 12; + then.tm_min = 0; + then.tm_sec = 0; + e_strftime_fix_am_pm (buf, 26, _("%x"), &then); + return g_strdup (buf); + } else { + return NULL; + } } else return NULL; case E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS: -- cgit v1.2.3