diff --git a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp index fbdd1a3654..8953de8c1a 100644 --- a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp +++ b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp @@ -949,10 +949,10 @@ bool CStaticFunctionDefinitions::AddElementDataSubscriber(CElement* pElement, co assert(szName); assert(pPlayer); - ESyncType lastSyncType; + ESyncType lastSyncType = ESyncType::LOCAL; CLuaArgument* pCurrentVariable = pElement->GetCustomData(szName, false, &lastSyncType); - if (lastSyncType == ESyncType::SUBSCRIBE) + if (pCurrentVariable != nullptr && lastSyncType == ESyncType::SUBSCRIBE) { if (!pPlayer->SubscribeElementData(pElement, szName)) return false;