From e5dcb9ac5e0bad1b702e2d443233c069c2ec0f65 Mon Sep 17 00:00:00 2001 From: RedSprend Date: Sun, 1 Dec 2024 03:30:09 +0100 Subject: [PATCH] Fix some potential null pointer dereference --- dlls/monster/CXenPLight.cpp | 7 +++++-- dlls/monster/CXenTree.cpp | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/monster/CXenPLight.cpp b/dlls/monster/CXenPLight.cpp index bc086b3e..2acd780b 100644 --- a/dlls/monster/CXenPLight.cpp +++ b/dlls/monster/CXenPLight.cpp @@ -57,8 +57,11 @@ void CXenPLight::Spawn(void) return; m_pGlow = CSprite::SpriteCreate(XEN_PLANT_GLOW_SPRITE, pev->origin + Vector(0, 0, (pev->mins.z + pev->maxs.z) * 0.5), FALSE); - m_pGlow->SetTransparency(kRenderGlow, pev->rendercolor.x, pev->rendercolor.y, pev->rendercolor.z, pev->renderamt, pev->renderfx); - m_pGlow->SetAttachment(edict(), 1); + if (m_pGlow) + { + m_pGlow->SetTransparency(kRenderGlow, pev->rendercolor.x, pev->rendercolor.y, pev->rendercolor.z, pev->renderamt, pev->renderfx); + m_pGlow->SetAttachment(edict(), 1); + } } diff --git a/dlls/monster/CXenTree.cpp b/dlls/monster/CXenTree.cpp index b0f0e782..0c902629 100644 --- a/dlls/monster/CXenTree.cpp +++ b/dlls/monster/CXenTree.cpp @@ -96,7 +96,8 @@ void CXenTree::Spawn(void) triggerPosition = pev->origin + (triggerPosition * 64); // Create the trigger m_pTrigger = CXenTreeTrigger::TriggerCreate(edict(), triggerPosition); - UTIL_SetSize(m_pTrigger->pev, Vector(-24, -24, 0), Vector(24, 24, 128)); + if (m_pTrigger) + UTIL_SetSize(m_pTrigger->pev, Vector(-24, -24, 0), Vector(24, 24, 128)); } const char* CXenTree::pAttackHitSounds[] =