From 797d10a1da886b59e2d7c5849adf9b58919e5786 Mon Sep 17 00:00:00 2001 From: Nairda <38843773+Nairdaa@users.noreply.github.com> Date: Mon, 19 Oct 2020 02:39:18 +0200 Subject: [PATCH] add checks for config parsing "might also as well add some checks to config parsing" // GAMMACASE --- addons/sourcemod/scripting/shavit-chat.sp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/addons/sourcemod/scripting/shavit-chat.sp b/addons/sourcemod/scripting/shavit-chat.sp index abe27b99..9a6c2141 100644 --- a/addons/sourcemod/scripting/shavit-chat.sp +++ b/addons/sourcemod/scripting/shavit-chat.sp @@ -259,23 +259,27 @@ bool LoadChatSettings() } gSM_Messages.Clear(); + bool failed; if(gEV_Type == Engine_CSS) { - kv.JumpToKey("CS:S"); + failed = !kv.JumpToKey("CS:S"); } else if(gEV_Type == Engine_CSGO) { - kv.JumpToKey("CS:GO"); + failed = !kv.JumpToKey("CS:GO"); } if(gEV_Type == Engine_TF2) { - kv.JumpToKey("TF2"); + failed = !kv.JumpToKey("TF2"); } - kv.GotoFirstSubKey(false); + if(failed || !kv.GotoFirstSubKey(false)) + { + SetFailState("Invalid \"configs/shavit-chatsettings.cfg\" file, or the game section is missing"); + } do {