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 429e57e..2314c2f 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));
+       GtkCMCTreeNode *node;
 
        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);