From 844d69f78e5f7b9ae65ed30d38f6c888e4656eb9 Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Thu, 16 Aug 2001 07:17:26 +0000 Subject: Check that name != NULL before we start messing with it. (Fixes bug #7329) 2001-08-16 Jon Trowbridge * gui/contact-editor/e-contact-quick-add.c (e_contact_quick_add): Check that name != NULL before we start messing with it. (Fixes bug #7329) svn path=/trunk/; revision=12084 --- addressbook/gui/contact-editor/e-contact-quick-add.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'addressbook/gui/contact-editor/e-contact-quick-add.c') diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c index a94153720f..27755d980a 100644 --- a/addressbook/gui/contact-editor/e-contact-quick-add.c +++ b/addressbook/gui/contact-editor/e-contact-quick-add.c @@ -318,7 +318,7 @@ e_contact_quick_add (const gchar *in_name, const gchar *email, { QuickAdd *qa; GtkWidget *dialog; - gchar *name; + gchar *name = NULL; gint len; /* We need to have *something* to work with. */ @@ -328,16 +328,18 @@ e_contact_quick_add (const gchar *in_name, const gchar *email, return; } - name = g_strdup (in_name); + if (in_name) { + name = g_strdup (in_name); - /* Remove extra whitespace and the quotes some mailers put around names. */ - g_strstrip (name); - len = strlen (name); - if ((name[0] == '\'' && name[len-1] == '\'') || (name[0] == '"' && name[len-1] == '"')) { - name[0] = ' '; - name[len-1] = ' '; + /* Remove extra whitespace and the quotes some mailers put around names. */ + g_strstrip (name); + len = strlen (name); + if ((name[0] == '\'' && name[len-1] == '\'') || (name[0] == '"' && name[len-1] == '"')) { + name[0] = ' '; + name[len-1] = ' '; + } + g_strstrip (name); } - g_strstrip (name); qa = quick_add_new (); qa->cb = cb; -- cgit v1.2.3