From e03f0e68d14824762d8edf68682b17c78f708de9 Mon Sep 17 00:00:00 2001 From: pointfeev Date: Mon, 9 May 2022 09:02:30 -0400 Subject: [PATCH] v3.4.3.2 - Fixed rare SteamCMD output string exception --- CreamInstaller/CreamInstaller.csproj | 2 +- CreamInstaller/Steam/SteamCMD.cs | 2 +- CreamInstaller/Utility/ExceptionHandler.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CreamInstaller/CreamInstaller.csproj b/CreamInstaller/CreamInstaller.csproj index bc339a6..fd4a53d 100644 --- a/CreamInstaller/CreamInstaller.csproj +++ b/CreamInstaller/CreamInstaller.csproj @@ -5,7 +5,7 @@ True Resources\ini.ico true - 3.4.3.1 + 3.4.3.2 Resources\ini.ico LICENSE 2021, pointfeev (https://github.com/pointfeev) diff --git a/CreamInstaller/Steam/SteamCMD.cs b/CreamInstaller/Steam/SteamCMD.cs index 6547632..211a83e 100644 --- a/CreamInstaller/Steam/SteamCMD.cs +++ b/CreamInstaller/Steam/SteamCMD.cs @@ -224,7 +224,7 @@ internal static class SteamCMD output = await Run(appId) ?? ""; int openBracket = output.IndexOf("{"); int closeBracket = output.LastIndexOf("}"); - if (!string.IsNullOrEmpty(output) && openBracket != -1 && closeBracket != -1) + if (openBracket != -1 && closeBracket != -1 && closeBracket > openBracket) { output = $"\"{appId}\"\n" + output[openBracket..(1 + closeBracket)]; output = output.Replace("ERROR! Failed to install app '4' (Invalid platform)", ""); diff --git a/CreamInstaller/Utility/ExceptionHandler.cs b/CreamInstaller/Utility/ExceptionHandler.cs index 65a8ed1..ce8bc2a 100644 --- a/CreamInstaller/Utility/ExceptionHandler.cs +++ b/CreamInstaller/Utility/ExceptionHandler.cs @@ -18,8 +18,8 @@ internal static class ExceptionHandler for (int i = 0; i < Math.Min(stackTrace.Length, 3); i++) { string line = stackTrace[i]; - int atNum = line.LastIndexOf("at "); - int inNum = line.LastIndexOf("in "); + int atNum = line.IndexOf("at "); + int inNum = line.IndexOf("in "); int ciNum = line.LastIndexOf(@"CreamInstaller\"); int lineNum = line.LastIndexOf(":line "); if (line is not null && atNum != -1)