1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

Make _alpm_filelist_contains() NULL-safe

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2011-10-14 14:50:27 -05:00
parent a33424f879
commit bf84dc4cf1

View File

@ -318,12 +318,16 @@ const alpm_file_t *_alpm_filelist_contains(alpm_filelist_t *filelist,
const char *name)
{
size_t i;
const alpm_file_t *file = filelist->files;
for(i = 0; i < filelist->count; i++) {
const alpm_file_t *file;
if(!filelist) {
return NULL;
}
for(file = filelist->files, i = 0; i < filelist->count; file++, i++) {
if(strcmp(file->name, name) == 0) {
return file;
}
file++;
}
return NULL;
}