commit cb7d8c252aaf504cf4d8508dea2570328c07a118
Author: Thomas Mittelstaedt <tmstaedt@t-mittelstaedt.de>
Date:   Sat Mar 27 01:39:48 2010 +0100

    More careful approach, just check for non-NULL-ness of closure.vals before accessing it\!

diff --git a/widgets/table/e-table-sorting-utils.c b/widgets/table/e-table-sorting-utils.c
index 344a7cf..7806424 100644
--- a/widgets/table/e-table-sorting-utils.c
+++ b/widgets/table/e-table-sorting-utils.c
@@ -110,6 +110,7 @@ e_table_sorting_utils_sort(ETableModel *source, ETableSortInfo *sort_info, ETabl
 	gint total_rows;
 	gint i;
 	gint j;
+	gint idx;
 	gint cols;
 	ETableSortClosure closure;
 
@@ -134,8 +135,11 @@ e_table_sorting_utils_sort(ETableModel *source, ETableSortInfo *sort_info, ETabl
 		col = e_table_header_get_column_by_col_idx(full_header, column.column);
 		if (col == NULL)
 			col = e_table_header_get_column (full_header, e_table_header_count (full_header) - 1);
-		for (i = 0; i < rows; i++) {
-			closure.vals[map_table[i] * cols + j] = e_table_model_value_at (source, col->compare_col, map_table[i]);
+		for (i = 0; (closure.vals != NULL) && (i < rows); i++) {
+			idx = map_table[i] * cols + j;
+			if (idx >= 0  &&  idx < (total_rows * cols)) {
+				closure.vals[idx] = e_table_model_value_at (source, col->compare_col, map_table[i]);
+			}
 		}
 		closure.compare[j] = col->compare;
 		closure.ascending[j] = column.ascending;
