From ac19d5492f290cc7f41e81dc6ff5873fc644f18f Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Wed, 4 Apr 2001 10:59:44 +0000 Subject: Made this work properly for models with 0 rows in the tree table adapter. 2001-04-04 Christopher James Lahey * e-tree-selection-model.c: Made this work properly for models with 0 rows in the tree table adapter. svn path=/trunk/; revision=9173 --- widgets/table/e-tree-selection-model.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c index d8eeb3f083..1854010fd7 100644 --- a/widgets/table/e-tree-selection-model.c +++ b/widgets/table/e-tree-selection-model.c @@ -123,6 +123,9 @@ etsm_node_at_row(ETreeSelectionModel *etsm, int row) { ETreePath path; + if (!(row >= 0 && row < e_table_model_row_count(E_TABLE_MODEL(etsm->priv->etta)))) + return NULL; + path = e_tree_table_adapter_node_at_row(etsm->priv->etta, row); if (path) @@ -673,6 +676,10 @@ etsm_is_row_selected (ESelectionModel *selection, gboolean ret_val; + g_return_val_if_fail(row < e_table_model_row_count(E_TABLE_MODEL(etsm->priv->etta)), FALSE); + g_return_val_if_fail(row >= 0, FALSE); + g_return_val_if_fail(selection != NULL, FALSE); + path = e_tree_table_adapter_node_at_row(etsm->priv->etta, row); selection_node = etsm_recurse_is_path_selected (selection, path, &ret_val); @@ -856,7 +863,13 @@ etsm_change_one_row(ESelectionModel *selection, int row, gboolean grow) { ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection); ETreeSelectionModelNode *node; - ETreePath path = e_tree_table_adapter_node_at_row(etsm->priv->etta, row); + ETreePath path; + + g_return_if_fail(row < e_table_model_row_count(E_TABLE_MODEL(etsm->priv->etta))); + g_return_if_fail(row >= 0); + g_return_if_fail(selection != NULL); + + path = e_tree_table_adapter_node_at_row(etsm->priv->etta, row); if (!path) return; -- cgit v1.2.3