aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/contact-editor
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui/contact-editor')
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c39
1 files changed, 23 insertions, 16 deletions
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));