Add a NULL check in summary_select_by_msg_list when selecting tree nodes.
authorAndrej Kacian <ticho@claws-mail.org>
Sun, 23 Sep 2018 14:44:45 +0000 (16:44 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Sun, 23 Sep 2018 14:44:45 +0000 (16:44 +0200)
This fixes an assertion failure when executing an action
which moves selected messages to a different folder. We
obviously cannot select previously selected messages if
they're not in current folder anymore.

src/summaryview.c

index 1fd33a9..0f7a6bd 100644 (file)
@@ -2225,7 +2225,8 @@ void summary_select_by_msg_list(SummaryView       *summaryview, GSList *msginfos)
        for(walk = msgnum_list; walk; walk = walk->next) {
                GtkCMCTreeNode *node;
                node = summary_find_msg_by_msgnum(summaryview, GPOINTER_TO_UINT(walk->data));
        for(walk = msgnum_list; walk; walk = walk->next) {
                GtkCMCTreeNode *node;
                node = summary_find_msg_by_msgnum(summaryview, GPOINTER_TO_UINT(walk->data));
-               gtk_cmctree_select(ctree, node);
+               if (node != NULL)
+                       gtk_cmctree_select(ctree, node);
        }
        END_LONG_OPERATION(summaryview);
        g_slist_free(msgnum_list);
        }
        END_LONG_OPERATION(summaryview);
        g_slist_free(msgnum_list);