From 19ef48ca02502abee72bec330d19fdf024c73197 Mon Sep 17 00:00:00 2001 From: Meivyn Date: Mon, 12 Apr 2021 20:37:39 -0400 Subject: [PATCH] Fix IndexOutOfRangeException on cmd --- IPA.Injector/Injector.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/IPA.Injector/Injector.cs b/IPA.Injector/Injector.cs index e2ec5c44..4113a4b1 100644 --- a/IPA.Injector/Injector.cs +++ b/IPA.Injector/Injector.cs @@ -51,7 +51,7 @@ namespace IPA.Injector for (var i = 0; i < cmd.Length; i++) { - if (cmd[i] == "-pid") + if (cmd[i] == "-pid" && cmd.Length > i + 1) { arg = cmd[i + 1]; break; @@ -79,7 +79,7 @@ namespace IPA.Injector // IMPORTANT: NO CALLS TO ANY LOGGER CAN HAPPEN BEFORE THIS var unused = StandardLogger.PrintFilter; #region // Above hack explaination - /* + /* * Due to an unknown bug in the version of Mono that Unity uses, if the first access to StandardLogger * is a call to a constructor, then Mono fails to load the type correctly. However, if the first access is to * the above static property (or maybe any, but I don't really know) it behaves as expected and works fine. @@ -275,7 +275,7 @@ namespace IPA.Injector using var ascModule = VirtualizedModule.Load(ascPath); ascModule.Virtualize(cAsmName, () => bkp?.Add(ascPath)); } - catch (Exception e) + catch (Exception e) { injector.Error($"Could not virtualize {ascPath}"); if (SelfConfig.Debug_.ShowHandledErrorStackTraces_)