From f6b2f4bd236097f7d5f52fb0d545d9388f2c6f7a Mon Sep 17 00:00:00 2001 From: Anonimus Date: Wed, 15 Oct 2025 23:52:52 -0400 Subject: [PATCH] Add SIGSEGV guard to highlight patch loading. --- src/k_hud.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/k_hud.c b/src/k_hud.c index 49b78d07b..a75504629 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -378,9 +378,23 @@ void K_LoadKartHUDGraphics(void) buffer[7] = '0'+(i+1); HU_UpdatePatch(&kp_facehighlight[i], "%s", buffer); - kp_facehighlight[i]->pivot.x = kp_facehighlight[i]->width / 2; - kp_facehighlight[i]->pivot.y = kp_facehighlight[i]->height / 2; - kp_facehighlight[i]->alignflags |= PATCHALIGN_USEPIVOTS; + // Blind-reading the patch causes a SIGSEGV on some machines, so let's try a guard. + patch_t *highlight = kp_facehighlight[i]; + + if ((highlight) && (highlight != NULL)) + { + highlight->pivot.x = highlight->width / 2; + highlight->pivot.y = highlight->height / 2; + highlight->alignflags |= PATCHALIGN_USEPIVOTS; + } + else + { +#ifdef PARANOIA + I_Error("Game recieved NULL highlight! (i = %d)\n", i); +#else + CONS_Alert(CONS_ERROR, M_GetText("Game recieved NULL highlight! (i = %d)\n"), i); +#endif + } } // Special minimap icons