diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Sort an empty list without handing qsort a null
Every list sorted here is null until its first entry, and C leaves a null base undefined even with nothing to sort. glibc declares it nonnull and its UBSan build aborted the stats page of a repository with no commits in the window, which the Linux matrix caught.
Diffstat (limited to 'source/ui-stats.c')
-rw-r--r--source/ui-stats.c2
1 file changed, 1 insertion, 1 deletion
diff --git a/source/ui-stats.c b/source/ui-stats.c
index f200b63..a332335 100644
--- a/source/ui-stats.c
+++ b/source/ui-stats.c
@@ -450,7 +450,7 @@ void cgit_show_stats(void)
}
if (collect_stats(period, &authors))
return;
- qsort(authors.items, authors.nr, sizeof(struct string_list_item), cmp_total_commits);
+ cgit_qsort(authors.items, authors.nr, sizeof(struct string_list_item), cmp_total_commits);
top = ctx.qry.ofs;
if (!top)