Fix a failed assertion in NNTP group list dialog
authorAndrej Kacian <ticho@claws-mail.org>
Sun, 4 Aug 2019 10:20:48 +0000 (12:20 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Sun, 4 Aug 2019 10:21:25 +0000 (12:21 +0200)
The code was trying to expand nodes of already subscribed
newsgroups, even if those newsgroups weren't being displayed
in the list, usually because of an active search pattern.

src/grouplistdialog.c

index 429e57eaeee423f2a04a0251a037c5d419edd3e2..2314c2f7cb6d8df1e68325552c40782a46c7a431 100644 (file)
@@ -379,11 +379,14 @@ static GtkCMCTreeNode *grouplist_create_branch(NewsGroupInfo *ginfo,
 static void grouplist_expand_upwards(GtkCMCTree *ctree, const gchar *name) {
        const gchar *ptr;
        gchar *newname=g_malloc0(strlen(name));
 static void grouplist_expand_upwards(GtkCMCTree *ctree, const gchar *name) {
        const gchar *ptr;
        gchar *newname=g_malloc0(strlen(name));
+       GtkCMCTreeNode *node;
 
        for (ptr=name; *ptr; ptr++) {
 
        for (ptr=name; *ptr; ptr++) {
-               if (*ptr == '.')
-                       gtk_cmctree_expand(ctree, 
-                               grouplist_hash_get_branch_node(newname));
+               if (*ptr == '.') {
+                       node = grouplist_hash_get_branch_node(newname);
+                       if (node != NULL)
+                               gtk_cmctree_expand(ctree, node);
+               }
                newname[ptr-name] = *ptr;
        }
        g_free(newname);
                newname[ptr-name] = *ptr;
        }
        g_free(newname);