diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-09-12 04:27:38 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-09-12 04:27:38 +0800 |
commit | 5b0b0ef1e0927bab72cdd9a874e17aa514c71609 (patch) | |
tree | e4de560cedfa3ad491a1894deab9013c013826e9 /addressbook | |
parent | df73f0ac4ee72c50ca2807796a6ccc187246b992 (diff) | |
download | gsoc2013-evolution-5b0b0ef1e0927bab72cdd9a874e17aa514c71609.tar gsoc2013-evolution-5b0b0ef1e0927bab72cdd9a874e17aa514c71609.tar.gz gsoc2013-evolution-5b0b0ef1e0927bab72cdd9a874e17aa514c71609.tar.bz2 gsoc2013-evolution-5b0b0ef1e0927bab72cdd9a874e17aa514c71609.tar.lz gsoc2013-evolution-5b0b0ef1e0927bab72cdd9a874e17aa514c71609.tar.xz 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')
-rw-r--r-- | addressbook/ChangeLog | 4 | ||||
-rw-r--r-- | addressbook/contact-editor/e-contact-editor.c | 39 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 39 |
3 files changed, 50 insertions, 32 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index d4a049e8a0..78233d029f 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,9 @@ 2000-09-11 Christopher James Lahey <clahey@helixcode.com> + * contact-editor/e-contact-editor.c: Fixed a crash error. + +2000-09-11 Christopher James Lahey <clahey@helixcode.com> + * ename/e-address-western.c: Fixed some warnings. 2000-09-11 Jesse Pavel <jpavel@helixcode.com> 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)); diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index 16c14bf585..c259ea9587 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/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)); |