diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Read a negative ref count as no limit
summary-branches, summary-tags and max-ref-count already listed every
ref at 0, but a negative value reached qsort as a count and crashed the
summary and refs pages, and emptied the branch switcher.
Diffstat (limited to 'source/ui-refs.c')
| -rw-r--r-- | source/ui-refs.c | 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 2 insertions, 4 deletions
diff --git a/source/ui-refs.c b/source/ui-refs.c index e4a0dd0..890a959 100644 --- a/source/ui-refs.c +++ b/source/ui-refs.c @@ -294,7 +294,7 @@ void cgit_print_branches(int maxcount) print_branch_header(); collect_branches(&list); - if (maxcount == 0 || maxcount > list.count) + if (maxcount <= 0 || maxcount > list.count) maxcount = list.count; // The date sort covers the list, the name sort only the rows about to @@ -323,9 +323,7 @@ void cgit_print_tags(int maxcount) if (list.count == 0) return; qsort(list.refs, list.count, sizeof(*list.refs), cmp_date); - if (!maxcount) - maxcount = list.count; - else if (maxcount > list.count) + if (maxcount <= 0 || maxcount > list.count) maxcount = list.count; print_tag_header(); for (i = 0; i < maxcount; i++) |
