add checks for config parsing

"might also as well add some checks to config parsing" // GAMMACASE
This commit is contained in:
Nairda 2020-10-19 02:39:18 +02:00 committed by GitHub
parent e2aedb4a0b
commit 797d10a1da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -259,23 +259,27 @@ bool LoadChatSettings()
} }
gSM_Messages.Clear(); gSM_Messages.Clear();
bool failed;
if(gEV_Type == Engine_CSS) if(gEV_Type == Engine_CSS)
{ {
kv.JumpToKey("CS:S"); failed = !kv.JumpToKey("CS:S");
} }
else if(gEV_Type == Engine_CSGO) else if(gEV_Type == Engine_CSGO)
{ {
kv.JumpToKey("CS:GO"); failed = !kv.JumpToKey("CS:GO");
} }
if(gEV_Type == Engine_TF2) 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 do
{ {