Commit ec68b682 authored by Natanael Copa's avatar Natanael Copa
Browse files

add: fix segfault when no packages are given

parent 9e58b2dd
...@@ -118,7 +118,7 @@ static int add_main(void *ctx, int argc, char **argv) ...@@ -118,7 +118,7 @@ static int add_main(void *ctx, int argc, char **argv)
} }
state = apk_state_new(&db); 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]); r = apk_state_lock_dependency(state, &pkgs->item[i]);
if (r != 0) { if (r != 0) {
apk_error("Unable to install '%s'", pkgs->item[i].name->name); apk_error("Unable to install '%s'", pkgs->item[i].name->name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment