Browse Source

Merge pull request #359 from Mystler/crashfix

Fix out of bounds crash in GetNPC()
Adam Johnson 11 years ago
parent
commit
a0329523db
  1. 4
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp

4
Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp

@ -784,7 +784,9 @@ plSynchedObject* plNetClientMgr::GetLocalPlayer(bool forceLoad) const
plSynchedObject* plNetClientMgr::GetNPC(uint32_t i) const plSynchedObject* plNetClientMgr::GetNPC(uint32_t i) const
{ {
return fNPCKeys[i] ? plSynchedObject::ConvertNoRef(fNPCKeys[i]->ObjectIsLoaded()) : nil; if (i >= fNPCKeys.size())
return nullptr;
return plSynchedObject::ConvertNoRef(fNPCKeys[i]->ObjectIsLoaded());
} }
void plNetClientMgr::AddNPCKey(const plKey& npc) void plNetClientMgr::AddNPCKey(const plKey& npc)

Loading…
Cancel
Save