fix bug 3559, 'Opening preferences window causes out of bounds read'
[claws.git] / src / gtk / prefswindow.c
index f6c840b5495d72fa3f43ca273f017d421f308eb4..3b9d3d64a02c7b61e7f374aa4cb59b131c21cb6d 100644 (file)
@@ -320,7 +320,7 @@ static void prefswindow_build_tree(GtkWidget *tree_view, GSList *prefs_pages,
                        gtk_tree_model_foreach(GTK_TREE_MODEL(store), 
                                               (GtkTreeModelForeachFunc) find_node_by_name,
                                               &find_name);
-                       if (find_name.found && page->path[i] != page->path[i-1]) {
+                       if (i > 0 && find_name.found && page->path[i] != page->path[i-1]) {
                                node = find_name.node;
                                gtk_tree_model_get(GTK_TREE_MODEL(store), &node,
                                                   PREFS_PAGE_DATA, &prefs_node,