From b530eb430743def1c4bb506d71b33735c7be429a Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Thu, 5 Jul 2001 07:05:51 +0000 Subject: Make sure start_row and end_row are within the number of rows in the 2001-07-05 Christopher James Lahey * e-table-item.c (e_table_item_row_diff): Make sure start_row and end_row are within the number of rows in the table. svn path=/trunk/; revision=10788 --- widgets/table/e-table-item.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'widgets') diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 5230ab7771..aac9439030 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -93,6 +93,8 @@ inline static gint model_to_view_row(ETableItem *eti, int row) { int i; + if (row == -1) + return -1; if (eti->uses_source_model) { ETableSubset *etss = E_TABLE_SUBSET(eti->table_model); if (eti->row_guess >= 0 && eti->row_guess < etss->n_map) { @@ -126,6 +128,8 @@ inline static gint model_to_view_col(ETableItem *eti, int col) { int i; + if (col == -1) + return -1; for (i = 0; i < eti->cols; i++) { ETableCol *ecol = e_table_header_get_column (eti->header, i); if (ecol->col_idx == col) @@ -689,6 +693,10 @@ e_table_item_row_diff (ETableItem *eti, int start_row, int end_row) int height_extra = eti->horizontal_draw_grid ? 1 : 0; total = 0; + if (start_row < 0) + start_row = 0; + if (end_row > eti->rows) + end_row = eti->rows; for (row = start_row; row < end_row; row++) total += eti_row_height (eti, row) + height_extra; -- cgit