diff --git a/gtk/gtktreestore.c b/gtk/gtktreestore.c index 91f43bfe6..b1dd27eaf 100644 --- a/gtk/gtktreestore.c +++ b/gtk/gtktreestore.c @@ -2515,15 +2515,13 @@ gtk_tree_store_move (GtkTreeStore *tree_store, } else { - /* move after without position is prepending */ - if (depth) - gtk_tree_store_iter_children (GTK_TREE_MODEL (tree_store), &dst_b, - &parent_iter); + /* move after without position is prepending; the row that + * moves is one of the children, so there is a first one */ + if (gtk_tree_store_iter_children (GTK_TREE_MODEL (tree_store), &dst_b, + depth ? &parent_iter : NULL)) + b = G_NODE (dst_b.user_data); else - gtk_tree_store_iter_children (GTK_TREE_MODEL (tree_store), &dst_b, - NULL); - - b = G_NODE (dst_b.user_data); + b = NULL; } /* if a is NULL, b is NULL too -- we are at the end of the list