mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
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
This commit is contained in:
parent
4dd1d73f80
commit
7240717198
@ -618,6 +618,11 @@ int get_max_column_count(GSList *items, COLUMN_LEN_FUNC len_func,
|
|||||||
int ret, len, n, col, max_columns;
|
int ret, len, n, col, max_columns;
|
||||||
|
|
||||||
items_count = g_slist_length(items);
|
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);
|
max_columns = max_width/(item_extra+item_min_size);
|
||||||
columns = g_new0(int *, max_columns);
|
columns = g_new0(int *, max_columns);
|
||||||
@ -680,6 +685,9 @@ GSList *columns_sort_list(GSList *list, int rows)
|
|||||||
GSList *tmp, *sorted;
|
GSList *tmp, *sorted;
|
||||||
int row, skip;
|
int row, skip;
|
||||||
|
|
||||||
|
if (list == NULL || rows == 0)
|
||||||
|
return list;
|
||||||
|
|
||||||
sorted = NULL;
|
sorted = NULL;
|
||||||
|
|
||||||
for (row = 0; row < rows; row++) {
|
for (row = 0; row < rows; row++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user