aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widgets/table/e-tree-model.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/widgets/table/e-tree-model.c b/widgets/table/e-tree-model.c
index 918c286b34..2b5f3fa6b0 100644
--- a/widgets/table/e-tree-model.c
+++ b/widgets/table/e-tree-model.c
@@ -909,7 +909,12 @@ e_tree_model_node_insert (ETreeModel *tree_model,
if (position == -1)
position = e_tree_model_node_num_visible_descendents (tree_model, parent_path) - 1;
- parent_row = e_tree_model_row_of_node (tree_model, parent_path);
+ /* if the parent is the root, no need to search for its position since it aint there */
+ if (parent_path->parent == NULL) {
+ parent_row = -1;
+ } else {
+ parent_row = e_tree_model_row_of_node (tree_model, parent_path);
+ }
priv->row_array = g_array_insert_val (priv->row_array,
parent_row + position + 1, new_path);