From 0d299402b90e36374f73957c4fcc0e0b33a7754d Mon Sep 17 00:00:00 2001 From: Mykola <231079699+heymykola@users.noreply.github.com> Date: Sat, 31 Jan 2026 12:23:54 -0500 Subject: [PATCH] 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 --- core/PlayerManager.cpp | 11 ++++++++--- gamedata/core.games/common.games.txt | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index 1d541daa..842ba815 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -2046,10 +2046,15 @@ void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity) else #endif { - INetChannel *pNetChan = static_cast(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(pNetChan->GetMsgHandler()); + if (INetChannel *pNetChan = static_cast(engine->GetPlayerNetInfo(m_iIndex))) + { + m_pIClient = static_cast(pNetChan->GetMsgHandler()); + } } } #endif diff --git a/gamedata/core.games/common.games.txt b/gamedata/core.games/common.games.txt index 7e0f702a..6deb2f13 100644 --- a/gamedata/core.games/common.games.txt +++ b/gamedata/core.games/common.games.txt @@ -405,6 +405,7 @@ "Keys" { "RadioMenuClosesOnInvalidSlot" "yes" + "SkipNetchanIClient" "no" } }