Skip to content

Commit 50b3c2d

Browse files
committed
pack: don't assert in the lock
1 parent e7eb6c6 commit 50b3c2d

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/pack.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,12 @@ int git_pack_foreach_entry(
12981298
return error;
12991299
}
13001300

1301-
GIT_ASSERT(p->index_map.data);
1301+
if (!p->index_map.data) {
1302+
git_error_set(GIT_ERROR_INTERNAL, "internal error: p->index_map.data == NULL");
1303+
git_mutex_unlock(&p->lock);
1304+
return -1;
1305+
}
1306+
13021307
index = p->index_map.data;
13031308

13041309
if (p->index_version > 1)
@@ -1387,7 +1392,11 @@ int git_pack_foreach_entry_offset(
13871392
if ((error = pack_index_open_locked(p)) < 0)
13881393
goto cleanup;
13891394

1390-
GIT_ASSERT(p->index_map.data);
1395+
if (!p->index_map.data) {
1396+
git_error_set(GIT_ERROR_INTERNAL, "internal error: p->index_map.data == NULL");
1397+
goto cleanup;
1398+
}
1399+
13911400
index = p->index_map.data;
13921401
}
13931402

@@ -1479,7 +1488,11 @@ static int pack_entry_find_offset(
14791488
if ((error = pack_index_open_locked(p)) < 0)
14801489
goto cleanup;
14811490

1482-
GIT_ASSERT(p->index_map.data);
1491+
if (!p->index_map.data) {
1492+
git_error_set(GIT_ERROR_INTERNAL, "internal error: p->index_map.data == NULL");
1493+
goto cleanup;
1494+
}
1495+
14831496
index = p->index_map.data;
14841497
level1_ofs = p->index_map.data;
14851498

0 commit comments

Comments
 (0)