libsmartcols: don't sort if cmpfunc() is not set

Reported-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
This commit is contained in:
Karel Zak 2016-01-18 10:47:22 +01:00
parent 7ad4b8503c
commit 8afabdb1fa
1 changed files with 1 additions and 1 deletions

View File

@ -1075,7 +1075,7 @@ static int cells_cmp_wrapper(struct list_head *a, struct list_head *b, void *dat
*/
int scols_sort_table(struct libscols_table *tb, struct libscols_column *cl)
{
if (!tb || !cl)
if (!tb || !cl || !cl->cmpfunc)
return -EINVAL;
DBG(TAB, ul_debugobj(tb, "sorting table"));