From 247bba1a94a4f115d6efdecfcb46afc8d3650e78 Mon Sep 17 00:00:00 2001 From: wootguy Date: Wed, 30 Oct 2024 20:36:43 -0700 Subject: [PATCH] fix crash --- dlls/CBasePlayer.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dlls/CBasePlayer.cpp b/dlls/CBasePlayer.cpp index 9148f192..f6536a39 100644 --- a/dlls/CBasePlayer.cpp +++ b/dlls/CBasePlayer.cpp @@ -4500,10 +4500,13 @@ void CBasePlayer :: UpdateClientData( void ) void CBasePlayer::Rename(const char* newName, bool fast, int msg_mode, edict_t* dst) { char* info = g_engfuncs.pfnGetInfoKeyBuffer(edict()); + if (!info || info[0] == '\0') { + return; + } + // not doing this because it triggers the "changed name" chat message //g_engfuncs.pfnSetClientKeyValue(entindex(), info, "name", (char*)newName); - static char userinfo[512]; if (fast) { @@ -4540,9 +4543,11 @@ void CBasePlayer::Rename(const char* newName, bool fast, int msg_mode, edict_t* return; } - - char* nameStart = strstr(info, "\\name\\") + 6; + if (!nameStart) { + return; + } + char* nameEnd = strstr(nameStart, "\\"); if (strlen(info) + strlen(newName) > 512 && nameStart) {