diff --git a/src/core/misc.c b/src/core/misc.c
index 48ab992f..b9bc70c7 100644
--- a/src/core/misc.c
+++ b/src/core/misc.c
@@ -618,6 +618,11 @@ int get_max_column_count(GSList *items, COLUMN_LEN_FUNC len_func,
 	int ret, len, n, col, max_columns;
 
 	items_count = g_slist_length(items);
+	if (items_count == 0) {
+		*save_column_widths = NULL;
+                *rows = 0;
+		return 0;
+	}
 
 	max_columns = max_width/(item_extra+item_min_size);
 	columns = g_new0(int *, max_columns);
@@ -680,6 +685,9 @@ GSList *columns_sort_list(GSList *list, int rows)
         GSList *tmp, *sorted;
 	int row, skip;
 
+	if (list == NULL || rows == 0)
+                return list;
+
 	sorted = NULL;
 
 	for (row = 0; row < rows; row++) {