Make _alpm_filelist_contains() NULL-safe
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
a33424f879
commit
bf84dc4cf1
1 changed files with 7 additions and 3 deletions
|
@ -318,12 +318,16 @@ const alpm_file_t *_alpm_filelist_contains(alpm_filelist_t *filelist,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
const alpm_file_t *file = filelist->files;
|
const alpm_file_t *file;
|
||||||
for(i = 0; i < filelist->count; i++) {
|
|
||||||
|
if(!filelist) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(file = filelist->files, i = 0; i < filelist->count; file++, i++) {
|
||||||
if(strcmp(file->name, name) == 0) {
|
if(strcmp(file->name, name) == 0) {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
file++;
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue