Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/conflict.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-10-14 14:50:27 -0500
committerDan McGee <dan@archlinux.org>2011-10-14 14:50:27 -0500
commitbf84dc4cf1b925cc3ac1fb3185efc50a21802ba4 (patch)
tree0187396622fdee56e785b07e625f6a97a367ab41 /lib/libalpm/conflict.c
parenta33424f87955c43652a61fcef5817df07e17bee3 (diff)
Make _alpm_filelist_contains() NULL-safe
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/conflict.c')
-rw-r--r--lib/libalpm/conflict.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 14c23f45..f686ca82 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -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;
}