@@ -4832,10 +4832,28 @@ void CPacketHandler::Packet_ResourceStart(NetBitStreamInterface& bitStream)
4832
4832
// Get the resource dynamic entity
4833
4833
CClientEntity* pResourceDynamicEntity = CElementIDs::GetElement (ResourceDynamicEntityID);
4834
4834
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
+
4835
4844
CResource* pResource = g_pClientGame->m_pResourceManager ->Add (usResourceID, szResourceName, pResourceEntity, pResourceDynamicEntity, strMinServerReq,
4836
4845
strMinClientReq, bEnableOOP);
4837
4846
if (pResource)
4838
4847
{
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
+
4839
4857
pResource->SetRemainingNoClientCacheScripts (usNoClientCacheScriptCount);
4840
4858
pResource->SetDownloadPriorityGroup (iDownloadPriorityGroup);
4841
4859
@@ -4958,7 +4976,18 @@ void CPacketHandler::Packet_ResourceStart(NetBitStreamInterface& bitStream)
4958
4976
{
4959
4977
// Load the resource now
4960
4978
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
+
4961
4989
pResource->Load ();
4990
+ }
4962
4991
}
4963
4992
}
4964
4993
0 commit comments