From d2ffe7ff2348edbe693ae3e648314c6626cb0e90 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 7 Oct 2026 20:23:56 +0200 Subject: [PATCH] fix faulty arithmetic on NULL pointer when drawing 3d models caused by localskin code.... sigh...... noticed this while messing with dynamic allocated (local)skins --- src/hardware/hw_md2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index f21f2f82d..ab36fa20a 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1146,8 +1146,8 @@ void HWR_DrawMD2(gl_vissprite_t *spr) // Look at HWR_ProjectSprite for more { - md2_t *md2s; - int skinnum; + md2_t *md2s = NULL; + int skinnum = 0; patch_t *gpatch, *blendgpatch; GLPatch_t *hwrPatch = NULL, *hwrBlendPatch = NULL; INT32 durs = spr->mobj->state->tics; @@ -1221,7 +1221,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr) skinnum = (skin_t *)spr->mobj->localskin - skins; } } - else + else if (spr->mobj->skin) { md2s = md2_playermodels; skinnum = (skin_t *)spr->mobj->skin - skins;