* Fixes a potential crash when deleting accounts
authorSergio Villar Senin <svillar@igalia.com>
Fri, 23 Jan 2009 10:05:50 +0000 (10:05 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Fri, 23 Jan 2009 10:05:50 +0000 (10:05 +0000)
pmo-trunk-r7254

src/hildon2/modest-msg-view-window.c
src/modest-ui-actions.c

index 315f3c8..226d5b5 100644 (file)
@@ -2280,7 +2280,7 @@ on_account_removed (TnyAccountStore *account_store,
                parent_acc = modest_tny_account_get_parent_modest_account_name_for_server_account (account);
 
                /* Close this window if I'm showing a message of the removed account */
-               if (strcmp (parent_acc, our_acc) == 0)
+               if (our_acc && parent_acc && strcmp (parent_acc, our_acc) == 0)
                        modest_ui_actions_on_close_window (NULL, MODEST_WINDOW (user_data));
        }
 }
index 0b00320..523435a 100644 (file)
@@ -1007,6 +1007,15 @@ get_info_from_header (TnyHeader *header, gboolean *is_draft, gboolean *can_open)
                *is_draft = TRUE; /* Open in editor if the message is in the Drafts folder */
        }
 
+       if (!account) {
+               TnyAccount *acc = tny_folder_get_account (folder);
+               if (acc) {
+                       account =
+                               g_strdup (modest_tny_account_get_parent_modest_account_name_for_server_account (acc));
+                       g_object_unref (acc);
+               }
+       }
+
        g_object_unref (folder);
 
        return account;