Partial bugfix for 57415
authorPhilip Van Hoof <philip@codeminded.be>
Thu, 31 May 2007 13:51:32 +0000 (13:51 +0000)
committerPhilip Van Hoof <philip@codeminded.be>
Thu, 31 May 2007 13:51:32 +0000 (13:51 +0000)
pmo-trunk-r2009

src/maemo/modest-address-book.c
src/modest-ui-actions.c

index abf876d..315b442 100644 (file)
@@ -132,16 +132,19 @@ modest_address_book_add_address (const gchar *address)
        }
        
        account = osso_abook_account_get (EVC_EMAIL, NULL, address);
-       dialog = osso_abook_add_to_contacts_dialog_new (contact_model, account);
-       g_object_unref (account);
-       gtk_dialog_run (GTK_DIALOG (dialog));
+       if (account)
+       {
+               dialog = osso_abook_add_to_contacts_dialog_new (contact_model, account);
+               g_object_unref (account);
+               gtk_dialog_run (GTK_DIALOG (dialog));
 
-       if (contact_model) {
-               g_object_unref (contact_model);
-               contact_model = NULL;
-       }
+               if (contact_model) {
+                       g_object_unref (contact_model);
+                       contact_model = NULL;
+               }
 
-       gtk_widget_destroy (dialog);
+               gtk_widget_destroy (dialog);
+       }
 
 }
 
index f974ffe..c647076 100644 (file)
@@ -313,8 +313,14 @@ modest_ui_actions_on_add_to_contacts (GtkAction *action, ModestWindow *win)
        clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
        selection = gtk_clipboard_wait_for_text (clipboard);
 
-       modest_address_book_add_address (selection);
-       g_free (selection);
+       /* Question: why is the clipboard being used here? 
+        * It doesn't really make a lot of sense. */
+
+       if (selection)
+       {
+               modest_address_book_add_address (selection);
+               g_free (selection);
+       }
 }
 
 void