summaryrefslogtreecommitdiff
path: root/src/test.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-07-27 15:25:29 +0300
committerTimo Teräs <timo.teras@iki.fi>2011-07-27 15:25:58 +0300
commit034c02f0de8e3e98587937c170b26937cb15ec69 (patch)
treea130c7dd44b5315a6b8dbddc7a0b2c5f1d2c28ee /src/test.c
parent9cd57a8fc7df0c5c72a1da1e5de093138ad0d3f7 (diff)
downloadapk-tools-034c02f0de8e3e98587937c170b26937cb15ec69.tar.gz
apk-tools-034c02f0de8e3e98587937c170b26937cb15ec69.tar.bz2
apk-tools-034c02f0de8e3e98587937c170b26937cb15ec69.tar.xz
apk-tools-034c02f0de8e3e98587937c170b26937cb15ec69.zip
test: don't crash if the expected files are not there
Diffstat (limited to 'src/test.c')
-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);
+ }
}
}