aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/contact-editor/e-contact-editor.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-09-12 04:27:38 +0800
committerChris Lahey <clahey@src.gnome.org>2000-09-12 04:27:38 +0800
commit5b0b0ef1e0927bab72cdd9a874e17aa514c71609 (patch)
treee4de560cedfa3ad491a1894deab9013c013826e9 /addressbook/contact-editor/e-contact-editor.c
parentdf73f0ac4ee72c50ca2807796a6ccc187246b992 (diff)
downloadgsoc2013-evolution-5b0b0ef1e0927bab72cdd9a874e17aa514c71609.tar.gz
gsoc2013-evolution-5b0b0ef1e0927bab72cdd9a874e17aa514c71609.tar.zst
gsoc2013-evolution-5b0b0ef1e0927bab72cdd9a874e17aa514c71609.zip
Fixed a crash error.
2000-09-11 Christopher James Lahey <clahey@helixcode.com> * contact-editor/e-contact-editor.c: Fixed a crash error. svn path=/trunk/; revision=5342
Diffstat (limited to 'addressbook/contact-editor/e-contact-editor.c')
-rw-r--r--addressbook/contact-editor/e-contact-editor.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/addressbook/contact-editor/e-contact-editor.c b/addressbook/contact-editor/e-contact-editor.c
index 16c14bf585..c259ea9587 100644
--- a/addressbook/contact-editor/e-contact-editor.c
+++ b/addressbook/contact-editor/e-contact-editor.c
@@ -261,7 +261,7 @@ style_makes_sense(const ECardName *name, char *company, int style)
return FALSE;
case 3: /* Fall Through */
case 4:
- if (company && *company && ((name->given && *name->given) || (name->family && *name->family)))
+ if (company && *company && name && ((name->given && *name->given) || (name->family && *name->family)))
return TRUE;
else
return FALSE;
@@ -279,19 +279,23 @@ name_to_style(const ECardName *name, char *company, int style)
switch (style) {
case 0:
stringptr = strings;
- if (name->family && *name->family)
- *(stringptr++) = name->family;
- if (name->given && *name->given)
- *(stringptr++) = name->given;
+ if (name) {
+ if (name->family && *name->family)
+ *(stringptr++) = name->family;
+ if (name->given && *name->given)
+ *(stringptr++) = name->given;
+ }
*stringptr = NULL;
string = g_strjoinv(", ", strings);
break;
case 1:
stringptr = strings;
- if (name->given && *name->given)
- *(stringptr++) = name->given;
- if (name->family && *name->family)
- *(stringptr++) = name->family;
+ if (name) {
+ if (name->given && *name->given)
+ *(stringptr++) = name->given;
+ if (name->family && *name->family)
+ *(stringptr++) = name->family;
+ }
*stringptr = NULL;
string = g_strjoinv(" ", strings);
break;
@@ -301,10 +305,12 @@ name_to_style(const ECardName *name, char *company, int style)
case 3: /* Fall Through */
case 4:
stringptr = strings;
- if (name->family && *name->family)
- *(stringptr++) = name->family;
- if (name->given && *name->given)
- *(stringptr++) = name->given;
+ if (name) {
+ if (name->family && *name->family)
+ *(stringptr++) = name->family;
+ if (name->given && *name->given)
+ *(stringptr++) = name->given;
+ }
*stringptr = NULL;
substring = g_strjoinv(", ", strings);
if (!(company && *company))
@@ -331,8 +337,6 @@ file_as_get_style (EContactEditor *editor)
int i;
int style;
- if (!name) return 0;
-
filestring = e_utf8_gtk_entry_get_text(file_as);
style = -1;
@@ -1015,7 +1019,7 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
e_contact_editor->email_list = NULL;
e_contact_editor->phone_list = NULL;
e_contact_editor->address_list = NULL;
- e_contact_editor->name = NULL;
+ e_contact_editor->name = e_card_name_new();
e_contact_editor->company = g_strdup("");
e_contact_editor->email_choice = 0;
@@ -1119,6 +1123,9 @@ e_contact_editor_destroy (GtkObject *object) {
if (e_contact_editor->simple)
gtk_object_unref(GTK_OBJECT(e_contact_editor->simple));
+ if (e_contact_editor->name)
+ e_card_name_free(e_contact_editor->name);
+
g_free (e_contact_editor->company);
gtk_object_unref(GTK_OBJECT(e_contact_editor->gui));