Guard IClient Netchan Path by GamedData (#2397)

* Guard IClient Netchan Path by Gamedir

Prevent crash on Source 2007 forks where GetPlayerNetInfo()->GetMsgHandler() is not compatible with IClient.

Only attempt the netchan/IClient path for known-safe game folders; otherwise leave m_pIClient null.

* Update PlayerManager.cpp

* Update PlayerManager.cpp

* Update PlayerManager.cpp

* Update PlayerManager.cpp

* Guard IClient Netchan Path by GameData

* Update common.games.txt

* Update PlayerManager.cpp

* Update common.games.txt
This commit is contained in:
Mykola
2026-01-31 17:23:54 +00:00
committed by GitHub
parent eddc83054c
commit 0d299402b9
2 changed files with 9 additions and 3 deletions
+8 -3
View File
@@ -2046,10 +2046,15 @@ void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity)
else
#endif
{
INetChannel *pNetChan = static_cast<INetChannel *>(engine->GetPlayerNetInfo(m_iIndex));
if (pNetChan)
m_pIClient = nullptr;
const char *skip = g_pGameConf->GetKeyValue("SkipNetchanIClient");
if (skip == nullptr || strcmp(skip, "yes") != 0)
{
m_pIClient = static_cast<IClient *>(pNetChan->GetMsgHandler());
if (INetChannel *pNetChan = static_cast<INetChannel *>(engine->GetPlayerNetInfo(m_iIndex)))
{
m_pIClient = static_cast<IClient *>(pNetChan->GetMsgHandler());
}
}
}
#endif
+1
View File
@@ -405,6 +405,7 @@
"Keys"
{
"RadioMenuClosesOnInvalidSlot" "yes"
"SkipNetchanIClient" "no"
}
}