summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/test.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/test.c b/src/test.c
index b074de8..20ab809 100644
--- a/src/test.c
+++ b/src/test.c
@@ -104,16 +104,20 @@ static int test_main(void *pctx, struct apk_database *db, int argc, char **argv)
/* load installed db */
if (ctx->installed_db != NULL) {
bs = apk_bstream_from_file(AT_FDCWD, ctx->installed_db);
- apk_db_index_read(db, bs, -1);
- bs->close(bs, NULL);
+ if (bs != NULL) {
+ apk_db_index_read(db, bs, -1);
+ bs->close(bs, NULL);
+ }
}
/* load additional indexes */
if (ctx->repos) {
for (i = 0; i < ctx->repos->num; i++) {
bs = apk_bstream_from_file(AT_FDCWD, ctx->repos->item[i]);
- apk_db_index_read(db, bs, i);
- bs->close(bs, NULL);
+ if (bs != NULL) {
+ apk_db_index_read(db, bs, i);
+ bs->close(bs, NULL);
+ }
}
}