2007-07-13 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Fri, 13 Jul 2007 09:15:50 +0000 (09:15 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Fri, 13 Jul 2007 09:15:50 +0000 (09:15 +0000)
* src/modest-ui-dimming-rules.c: (_selected_folder_is_root):
Fix my previous commit, to avoid unrefing a NULL TnyFolderStore.

pmo-trunk-r2733

ChangeLog2
src/modest-ui-dimming-rules.c

index c5885da..e13bce3 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-13  Murray Cumming  <murrayc@murrayc.com>
+
+       * src/modest-ui-dimming-rules.c: (_selected_folder_is_root):
+       Fix my previous commit, to avoid unrefing a NULL TnyFolderStore.
+
 2007-07-12  Armin Burgmeier  <armin@openismus.com>
 
        * src/maemo/modest-main-window.c: Make default account appear bold
index 66ee5db..486ef45 100644 (file)
@@ -1167,12 +1167,15 @@ _selected_folder_is_root (ModestMainWindow *win)
        /* All accounts are root items: */
        GtkWidget *folder_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(win),
                                                           MODEST_WIDGET_TYPE_FOLDER_VIEW);
-       if (folder_view) {                                         
+       if (folder_view) {                                      
+               gboolean is_account = FALSE;
                TnyFolderStore *folder_store = 
                        modest_folder_view_get_selected (MODEST_FOLDER_VIEW(folder_view));
-               const gboolean is_account = TNY_IS_ACCOUNT (folder_store);
-               g_object_unref (folder_store);
-               folder_store = NULL;
+               if (folder_store) {
+                       is_account = TNY_IS_ACCOUNT (folder_store);
+                       g_object_unref (folder_store);
+                       folder_store = NULL;
+               }
                
                if (is_account)
                        return TRUE;