bugfix: only sort non-NULL array

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2020-10-31 13:06:09 -07:00
parent ce4bfa4cc2
commit da66093ef4

View File

@ -322,7 +322,8 @@ mtp_get_file_list(dc_device_t *abstract, struct file_list *files)
free(rawdevices); free(rawdevices);
DEBUG(abstract->context, "Found %d files", files->nr); DEBUG(abstract->context, "Found %d files", files->nr);
qsort(files->array, files->nr, sizeof(struct fit_file), name_cmp); if (files->array)
qsort(files->array, files->nr, sizeof(struct fit_file), name_cmp);
return DC_STATUS_SUCCESS; return DC_STATUS_SUCCESS;
} }