asm/preproc.c: fix NULL pointer on %exitrep outside %rep

When %exitrep incorrectly occurs outside a %rep block, do_exit_macro()
returns NULL, but the %exitrep code would try to set m->in_progress =
1 anyway, causing a NULL pointer dereference and crashing NASM.

Add a NULL pointer guard around this assignment; an error has already
been issued.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin (Intel) 2026-04-10 13:06:34 -07:00
parent d7c7de072f
commit c8ea2d906d

View file

@ -5204,7 +5204,8 @@ static int do_directive(Token *tline, Token **output, bool suppressed)
case PP_EXITREP:
{
MMacro *m = do_exit_macro(dname, false);
m->in_progress = 1; /* No more repeats */
if (m)
m->in_progress = 1; /* No more repeats */
break;
}