Commit 034c02f0 authored by Timo Teräs's avatar Timo Teräs

test: don't crash if the expected files are not there

parent 9cd57a8f
...@@ -104,16 +104,20 @@ static int test_main(void *pctx, struct apk_database *db, int argc, char **argv) ...@@ -104,16 +104,20 @@ static int test_main(void *pctx, struct apk_database *db, int argc, char **argv)
/* load installed db */ /* load installed db */
if (ctx->installed_db != NULL) { if (ctx->installed_db != NULL) {
bs = apk_bstream_from_file(AT_FDCWD, ctx->installed_db); bs = apk_bstream_from_file(AT_FDCWD, ctx->installed_db);
apk_db_index_read(db, bs, -1); if (bs != NULL) {
bs->close(bs, NULL); apk_db_index_read(db, bs, -1);
bs->close(bs, NULL);
}
} }
/* load additional indexes */ /* load additional indexes */
if (ctx->repos) { if (ctx->repos) {
for (i = 0; i < ctx->repos->num; i++) { for (i = 0; i < ctx->repos->num; i++) {
bs = apk_bstream_from_file(AT_FDCWD, ctx->repos->item[i]); bs = apk_bstream_from_file(AT_FDCWD, ctx->repos->item[i]);
apk_db_index_read(db, bs, i); if (bs != NULL) {
bs->close(bs, NULL); apk_db_index_read(db, bs, i);
bs->close(bs, NULL);
}
} }
} }
......
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