From 80a0f3df67cde78b2873944730cffe06ea0073c6 Mon Sep 17 00:00:00 2001 From: Histalek <16392835+Histalek@users.noreply.github.com> Date: Wed, 27 Nov 2024 19:24:30 +0100 Subject: [PATCH] fix(cl_main): Prevent client lua error (#1682) This fixes #1648 in cases where not all entities have been initialized for a client. --- CHANGELOG.md | 1 + gamemodes/terrortown/gamemode/client/cl_main.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0ed36923..eca2d8417 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel - Fixed spectating player still being visible through thermalvision after killing that player (by @MrXonte) - Fixed Magneto-stick not using C_Hands (by @SvveetMavis) - Fixed console error when dropping ammo for weapons with no AmmoEnt (by @MrXonte) +- Fixed client error for a not fully initialized client (by @Histalek) - Fixed the targetID corpse hint not respecting `ttt_identify_body_woconfirm` (by @Histalek) - Fixed the beacon not being properly translated when placed (by @Histalek) diff --git a/gamemodes/terrortown/gamemode/client/cl_main.lua b/gamemodes/terrortown/gamemode/client/cl_main.lua index f218446b4..7ca34cf02 100644 --- a/gamemodes/terrortown/gamemode/client/cl_main.lua +++ b/gamemodes/terrortown/gamemode/client/cl_main.lua @@ -484,7 +484,7 @@ function GM:ClearClientState() local client = LocalPlayer() - if not client:IsReady() then + if not IsValid(client) or not client:IsReady() then return end