diff options
author | Timo Teräs <timo.teras@iki.fi> | 2011-07-27 15:25:29 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2011-07-27 15:25:58 +0300 |
commit | 034c02f0de8e3e98587937c170b26937cb15ec69 (patch) | |
tree | a130c7dd44b5315a6b8dbddc7a0b2c5f1d2c28ee /src/test.c | |
parent | 9cd57a8fc7df0c5c72a1da1e5de093138ad0d3f7 (diff) | |
download | apk-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.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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); + } } } |