From 709bbe3db03603eb1451776e7bd67cf61ad69297 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 30 Mar 2018 16:40:31 +0300 Subject: [PATCH] Fixed crash on accessing player sprite's state in software renderer https://forum.zdoom.org/viewtopic.php?t=60034 --- src/polyrenderer/scene/poly_playersprite.cpp | 3 ++- src/swrenderer/things/r_playersprite.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/polyrenderer/scene/poly_playersprite.cpp b/src/polyrenderer/scene/poly_playersprite.cpp index faf2f2a9a..5626e6f7b 100644 --- a/src/polyrenderer/scene/poly_playersprite.cpp +++ b/src/polyrenderer/scene/poly_playersprite.cpp @@ -354,7 +354,8 @@ void RenderPolyPlayerSprites::RenderSprite(PolyRenderThread *thread, DPSprite *p invertcolormap = !invertcolormap; } - bool fullbright = !foggy && pspr->GetState()->GetFullbright(); + const FState* const psprState = pspr->GetState(); + bool fullbright = !foggy && (psprState == nullptr ? false : psprState->GetFullbright()); bool fadeToBlack = (vis.RenderStyle.Flags & STYLEF_FadeToBlack) != 0; vis.Light.SetColormap(0, spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack); diff --git a/src/swrenderer/things/r_playersprite.cpp b/src/swrenderer/things/r_playersprite.cpp index b0021ca32..240f8e0c2 100644 --- a/src/swrenderer/things/r_playersprite.cpp +++ b/src/swrenderer/things/r_playersprite.cpp @@ -357,7 +357,8 @@ namespace swrenderer invertcolormap = !invertcolormap; } - bool fullbright = !foggy && pspr->GetState()->GetFullbright(); + const FState* const psprState = pspr->GetState(); + bool fullbright = !foggy && (psprState == nullptr ? false : psprState->GetFullbright()); bool fadeToBlack = (vis.RenderStyle.Flags & STYLEF_FadeToBlack) != 0; vis.Light.SetColormap(0, spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack);