refdb_fs: don't crash when the repo doesn't have a path
diff --git a/src/refdb_fs.c b/src/refdb_fs.c
index 5c8e59f..62965a6 100644
--- a/src/refdb_fs.c
+++ b/src/refdb_fs.c
@@ -181,6 +181,9 @@ static int packed_load(refdb_fs_backend *backend)
GITERR_CHECK_ALLOC(ref_cache->packfile);
}
+ if (backend->path == NULL)
+ return 0;
+
result = reference_read(&packfile, &ref_cache->packfile_time,
backend->path, GIT_PACKEDREFS_FILE, &updated);
@@ -1150,6 +1153,10 @@ static int setup_namespace(git_buf *path, git_repository *repo)
{
char *parts, *start, *end;
+ /* Not all repositories have a path */
+ if (repo->path_repository == NULL)
+ return 0;
+
/* Load the path to the repo first */
git_buf_puts(path, repo->path_repository);