summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-08-30 08:31:50 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2021-08-30 09:02:49 -0400
commit50b3c2d56d736c9168b46038ab996ca5c248aa46 (patch)
tree60095e8e832c581006723d062d429eb693c386a3
parente7eb6c6bb024f0735798494f4e070b370d8caf8b (diff)
downloadlibgit2-50b3c2d56d736c9168b46038ab996ca5c248aa46.tar.gz
pack: don't assert in the lock
-rw-r--r--src/pack.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/pack.c b/src/pack.c
index 94b1ecd9d..aadf3f2be 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -1298,7 +1298,12 @@ int git_pack_foreach_entry(
return error;
}
- GIT_ASSERT(p->index_map.data);
+ if (!p->index_map.data) {
+ git_error_set(GIT_ERROR_INTERNAL, "internal error: p->index_map.data == NULL");
+ git_mutex_unlock(&p->lock);
+ return -1;
+ }
+
index = p->index_map.data;
if (p->index_version > 1)
@@ -1387,7 +1392,11 @@ int git_pack_foreach_entry_offset(
if ((error = pack_index_open_locked(p)) < 0)
goto cleanup;
- GIT_ASSERT(p->index_map.data);
+ if (!p->index_map.data) {
+ git_error_set(GIT_ERROR_INTERNAL, "internal error: p->index_map.data == NULL");
+ goto cleanup;
+ }
+
index = p->index_map.data;
}
@@ -1479,7 +1488,11 @@ static int pack_entry_find_offset(
if ((error = pack_index_open_locked(p)) < 0)
goto cleanup;
- GIT_ASSERT(p->index_map.data);
+ if (!p->index_map.data) {
+ git_error_set(GIT_ERROR_INTERNAL, "internal error: p->index_map.data == NULL");
+ goto cleanup;
+ }
+
index = p->index_map.data;
level1_ofs = p->index_map.data;