treestore: Fix segfault when reordering non-existing children

Calling gtk_tree_store_reorder() on a node without children would cause a
segfault; Fixes https://bugzilla.gnome.org/show_bug.cgi?id=698396

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
This commit is contained in:
Olivier Brunel 2013-10-15 15:07:28 +02:00 committed by Matthias Clasen
parent 75c22332d0
commit 0d2d1904b1

View File

@ -2280,6 +2280,12 @@ gtk_tree_store_reorder (GtkTreeStore *tree_store,
else
level = G_NODE (parent->user_data)->children;
if (G_UNLIKELY (!level))
{
g_warning ("%s: Cannot reorder, parent has no children", G_STRLOC);
return;
}
/* count nodes */
node = level;
while (node)