summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/add.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/add.c b/src/add.c
index f07bd8d..a1d50cd 100644
--- a/src/add.c
+++ b/src/add.c
@@ -118,7 +118,7 @@ static int add_main(void *ctx, int argc, char **argv)
}
state = apk_state_new(&db);
- for (i = 0; i < pkgs->num; i++) {
+ for (i = 0; (pkgs != NULL) && i < pkgs->num; i++) {
r = apk_state_lock_dependency(state, &pkgs->item[i]);
if (r != 0) {
apk_error("Unable to install '%s'", pkgs->item[i].name->name);