log_ref_setup(): improve robustness against races
[gitweb.git] / mailinfo.c
index 2fb3877ee44e9cdc83c43fa23971f02a94b5a49f..a489d9d0fbcc37a1198247a8daae4b3104ebe284 100644 (file)
@@ -710,7 +710,8 @@ static void flush_inbody_header_accum(struct mailinfo *mi)
 {
        if (!mi->inbody_header_accum.len)
                return;
-       assert(check_header(mi, &mi->inbody_header_accum, mi->s_hdr_data, 0));
+       if (!check_header(mi, &mi->inbody_header_accum, mi->s_hdr_data, 0))
+               die("BUG: inbody_header_accum, if not empty, must always contain a valid in-body header");
        strbuf_reset(&mi->inbody_header_accum);
 }