Fix missing NULL checks

This commit is contained in:
Colin Leroy 2014-06-05 16:58:01 +02:00
parent d2da356bde
commit 8a6b07b194

View file

@ -472,20 +472,23 @@ gboolean addressadd_selection(const gchar *name, const gchar *address,
returned_name, returned_name,
address, address,
returned_remarks); returned_remarks);
person->status = ADD_ENTRY;
if (picture) { if (person != NULL) {
GError *error = NULL; person->status = ADD_ENTRY;
gchar *name = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S,
ADDRITEM_ID(person), ".png", NULL ); if (picture) {
gdk_pixbuf_save(picture, name, "png", &error, NULL); GError *error = NULL;
if (error) { gchar *name = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S,
g_warning(_("Failed to save image: \n%s"), ADDRITEM_ID(person), ".png", NULL );
error->message); gdk_pixbuf_save(picture, name, "png", &error, NULL);
g_error_free(error); if (error) {
g_warning(_("Failed to save image: \n%s"),
error->message);
g_error_free(error);
}
addritem_person_set_picture( person, ADDRITEM_ID(person) ) ;
g_free( name );
} }
addritem_person_set_picture( person, ADDRITEM_ID(person) ) ;
g_free( name );
} }
#else #else
ContactData* contact = g_new0(ContactData, 1); ContactData* contact = g_new0(ContactData, 1);
@ -524,7 +527,7 @@ gboolean addressadd_selection(const gchar *name, const gchar *address,
contact_data_free(&contact); contact_data_free(&contact);
#endif #endif
#ifdef USE_LDAP #ifdef USE_LDAP
if (fi->book->type == ADBOOKTYPE_LDAP) { if (person != NULL && fi->book->type == ADBOOKTYPE_LDAP) {
LdapServer *server = (LdapServer *) fi->book; LdapServer *server = (LdapServer *) fi->book;
ldapsvr_set_modified(server, TRUE); ldapsvr_set_modified(server, TRUE);
ldapsvr_update_book(server, person); ldapsvr_update_book(server, person);