From af9902736652ccd8e616ed8cac218526d8805198 Mon Sep 17 00:00:00 2001 From: Asher Baker Date: Tue, 23 Aug 2016 10:37:41 +0100 Subject: [PATCH] Fixed a couple of issues with steam.inf parsing --- extension/extension.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/extension/extension.cpp b/extension/extension.cpp index e369a2e..292dc23 100644 --- a/extension/extension.cpp +++ b/extension/extension.cpp @@ -554,13 +554,19 @@ void Accelerator::OnCoreMapStart(edict_t *pEdictList, int edictCount, int client char steamInfPath[512]; g_pSM->BuildPath(Path_Game, steamInfPath, sizeof(steamInfPath), "steam.inf"); - char steamInfTemp[256] = {0}; FILE *f = fopen(steamInfPath, "rb"); + if (!f) { + return; + } + + char steamInfTemp[256] = {0}; fread(steamInfTemp, sizeof(char), sizeof(steamInfTemp) - 1, f); + fclose(f); // This is horrible, but I'm busy and this is // the first thing I thought of that would work. + steamInf[0] = '\0'; unsigned source = 0; strcat(steamInf, "\nSteam_"); unsigned target = strlen(steamInf);