Skip to content

Commit 0c3975f

Browse files
committed
Add logging for issue #1077
1 parent f2407e7 commit 0c3975f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Client/mods/deathmatch/logic/CPacketHandler.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4832,10 +4832,28 @@ void CPacketHandler::Packet_ResourceStart(NetBitStreamInterface& bitStream)
48324832
// Get the resource dynamic entity
48334833
CClientEntity* pResourceDynamicEntity = CElementIDs::GetElement(ResourceDynamicEntityID);
48344834

4835+
if (!pResourceEntity || !pResourceDynamicEntity)
4836+
{
4837+
// Crash investigation code for forced crash in CResource::Load() at `assert(0);` - m_pResourceEntity is null
4838+
WriteDebugEvent(SString("Packet_ResourceStart() [1] - pResourceEntity: %p (ID: %u), pResourceDynamicEntity: %p (ID: %u)", pResourceEntity,
4839+
ResourceEntityID.Value(), pResourceDynamicEntity, ResourceDynamicEntityID.Value()));
4840+
assert(false);
4841+
return;
4842+
}
4843+
48354844
CResource* pResource = g_pClientGame->m_pResourceManager->Add(usResourceID, szResourceName, pResourceEntity, pResourceDynamicEntity, strMinServerReq,
48364845
strMinClientReq, bEnableOOP);
48374846
if (pResource)
48384847
{
4848+
if (!pResource->GetResourceEntity())
4849+
{
4850+
// Crash investigation code for forced crash in CResource::Load() at `assert(0);` - m_pResourceEntity is null
4851+
WriteDebugEvent(SString("Packet_ResourceStart() [2] - pResourceEntity: %p (ID: %u), pResourceDynamicEntity: %p (ID: %u)", pResourceEntity,
4852+
ResourceEntityID.Value(), pResourceDynamicEntity, ResourceDynamicEntityID.Value()));
4853+
assert(false);
4854+
return;
4855+
}
4856+
48394857
pResource->SetRemainingNoClientCacheScripts(usNoClientCacheScriptCount);
48404858
pResource->SetDownloadPriorityGroup(iDownloadPriorityGroup);
48414859

@@ -4958,7 +4976,18 @@ void CPacketHandler::Packet_ResourceStart(NetBitStreamInterface& bitStream)
49584976
{
49594977
// Load the resource now
49604978
if (pResource->CanBeLoaded())
4979+
{
4980+
if (!pResource->GetResourceEntity())
4981+
{
4982+
// Crash investigation code for forced crash in CResource::Load() at `assert(0);` - m_pResourceEntity is null
4983+
WriteDebugEvent(SString("Packet_ResourceStart() [3] - pResourceEntity: %p (ID: %u), pResourceDynamicEntity: %p (ID: %u)", pResourceEntity,
4984+
ResourceEntityID.Value(), pResourceDynamicEntity, ResourceDynamicEntityID.Value()));
4985+
assert(false);
4986+
return;
4987+
}
4988+
49614989
pResource->Load();
4990+
}
49624991
}
49634992
}
49644993

0 commit comments

Comments
 (0)