summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-02-02 22:09:11 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-02-02 22:09:11 +0000
commit72407171983277df44c1cfe62e3f7abdff9cfa6d (patch)
treee6eacec3cb3150e5228609823053199a24964aa3 /src
parent4dd1d73f80a9aacfffb67eb3da315ec5c997dd12 (diff)
downloadirssi-72407171983277df44c1cfe62e3f7abdff9cfa6d.zip
get_max_column_count(), columns_sort_list(): fixed to work properly
with empty list git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1176 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/core/misc.c8
1 files changed, 8 insertions, 0 deletions
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++) {