prevent crash in packfile test if pack file doesn't exist
diff --git a/regress/packfiles/packfile_test.c b/regress/packfiles/packfile_test.c
index 4889b1d..5be02f7 100644
--- a/regress/packfiles/packfile_test.c
+++ b/regress/packfiles/packfile_test.c
@@ -46,9 +46,9 @@ packfile_read_idx(const char *repo_path)
if (err) {
printf("got_packidx_open: %s\n", err->msg);
ret = 0;
- }
+ } else
+ got_packidx_close(packidx);
- got_packidx_close(packidx);
free(fullpath);
return ret;
}