From 1852f14f30347847bda89a49cb7946da243888ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Lu=C3=ADs=20Vaz=20Silva?= Date: Tue, 1 Aug 2023 13:42:49 -0300 Subject: [PATCH] fix rare crash due to null caller --- src/rendering/hwrenderer/scene/hw_weapon.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rendering/hwrenderer/scene/hw_weapon.cpp b/src/rendering/hwrenderer/scene/hw_weapon.cpp index 58c0824a5a..809ad797e7 100644 --- a/src/rendering/hwrenderer/scene/hw_weapon.cpp +++ b/src/rendering/hwrenderer/scene/hw_weapon.cpp @@ -690,7 +690,7 @@ void HWDrawInfo::PreparePlayerSprites2D(sector_t * viewsector, area_t in_area) VMFunction * ModifyBobLayer = nullptr; DVector2 bobxy = DVector2(weap.bobx , weap.boby); - if(weap.weapon) + if(weap.weapon && weap.weapon->GetCaller()) { PClass * cls = weap.weapon->GetCaller()->GetClass(); ModifyBobLayer = cls->Virtuals.Size() > ModifyBobLayerVIndex ? cls->Virtuals[ModifyBobLayerVIndex] : nullptr; @@ -774,7 +774,7 @@ void HWDrawInfo::PreparePlayerSprites3D(sector_t * viewsector, area_t in_area) DVector3 rotation = DVector3(weap.rotation); DVector3 pivot = DVector3(weap.pivot); - if(weap.weapon) + if(weap.weapon && weap.weapon->GetCaller()) { PClass * cls = weap.weapon->GetCaller()->GetClass(); ModifyBobLayer3D = cls->Virtuals.Size() > ModifyBobLayer3DVIndex ? cls->Virtuals[ModifyBobLayer3DVIndex] : nullptr;