Skip to content

Commit

Permalink
Sanity check to avoid potential null pointer deref
Browse files Browse the repository at this point in the history
  • Loading branch information
plenarius committed Sep 26, 2024
1 parent e8829c0 commit a0ce4da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Plugins/Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -953,9 +953,9 @@ NWNX_EXPORT ArgumentStack SetPersistentLocation(ArgumentStack&& args)

// Fake some changes to their area/position as though they had a TURD
auto *pWP = Utils::AsNWSWaypoint(Utils::GetGameObject(wpOID));
if (pWP)
auto pCreature = Utils::AsNWSCreature(Utils::GetGameObject(pPlayer->m_oidNWSObject));
if (pWP && pCreature)
{
auto pCreature = Utils::AsNWSCreature(Utils::GetGameObject(pPlayer->m_oidNWSObject));
pCreature->m_oidDesiredArea = pWP->m_oidArea;
pCreature->m_vDesiredAreaLocation = pWP->m_vPosition;
pCreature->m_bDesiredAreaUpdateComplete = false;
Expand Down

0 comments on commit a0ce4da

Please sign in to comment.