Adjust code added in 2775d8724d7 (packed_ref_store: implement reference transactions, 2017-09-08) to BUG() out in a case there GCC v12's -fanalyzer flagged that the "iter->oid" seen in the context was reachable where iter was NULL. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> --- refs/packed-backend.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/refs/packed-backend.c b/refs/packed-backend.c index 97b68377673..65991bbcaf5 100644 --- a/refs/packed-backend.c +++ b/refs/packed-backend.c @@ -1226,6 +1226,8 @@ static int write_with_updates(struct packed_ref_store *refs, struct object_id peeled; int peel_error = ref_iterator_peel(iter, &peeled); + if (!iter) + BUG("must have iter if cmp < 0"); if (write_packed_entry(out, iter->refname, iter->oid, peel_error ? NULL : &peeled)) -- 2.36.1.1124.g577fa9c2ebd