From 01d76f259086c09eadee101f6c28bcb06a9e11b0 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Wed, 1 Aug 2001 07:30:11 +0000 Subject: Made this not query the 0th row if there are 0 rows in the table. Fixes 2001-08-01 Christopher James Lahey * e-cell-toggle.c (etog_max_width): Made this not query the 0th row if there are 0 rows in the table. Fixes Ximian bug #5640. svn path=/trunk/; revision=11542 --- widgets/table/e-cell-toggle.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c index 45971f6f18..e85418e593 100644 --- a/widgets/table/e-cell-toggle.c +++ b/widgets/table/e-cell-toggle.c @@ -233,16 +233,15 @@ static int etog_max_width (ECellView *ecell_view, int model_col, int view_col) { ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell); - void *_value = e_table_model_value_at (ecell_view->e_table_model, model_col, 0); - int max_width = gdk_pixbuf_get_width (toggle->images[GPOINTER_TO_INT (_value)]); + int max_width = 0; int number_of_rows; int row; number_of_rows = e_table_model_row_count (ecell_view->e_table_model); - for (row = 1; row < number_of_rows; row++) { - void *_value = e_table_model_value_at (ecell_view->e_table_model, - model_col, row); - max_width = MAX (max_width, gdk_pixbuf_get_width (toggle->images[GPOINTER_TO_INT (_value)])); + for (row = 0; row < number_of_rows; row++) { + void *value = e_table_model_value_at (ecell_view->e_table_model, + model_col, row); + max_width = MAX (max_width, gdk_pixbuf_get_width (toggle->images[GPOINTER_TO_INT (value)])); } return max_width; -- cgit