diff --git a/widgets/table/e-table-sorting-utils.c b/widgets/table/e-table-sorting-utils.c
index 344a7cf..d34caa7 100644
--- a/widgets/table/e-table-sorting-utils.c
+++ b/widgets/table/e-table-sorting-utils.c
@@ -121,6 +121,8 @@ e_table_sorting_utils_sort(ETableModel *source, ETableSortInfo *sort_info, ETabl
 	g_return_if_fail(E_IS_TABLE_HEADER(full_header));
 
 	total_rows = e_table_model_row_count(source);
+	g_return_if_fail(total_rows > 0);
+
 	cols = e_table_sort_info_sorting_get_count(sort_info);
 	closure.cols = cols;
 
