From 74a9ff74b25857bfe5f14cceddeea987f0510985 Mon Sep 17 00:00:00 2001 From: Recrown Date: Tue, 8 Jan 2019 15:42:04 -0600 Subject: [PATCH] fixed crash on invalid input followed by -i for texture packer command. --- .../TextureAtlasTools/TexturePackerCommand.cs | 5 +++++ RecrownedAthenaeum/RecrownedAthenaeum.csproj | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/RecrownedAthenaeum.ConsoleTools/TextureAtlasTools/TexturePackerCommand.cs b/RecrownedAthenaeum.ConsoleTools/TextureAtlasTools/TexturePackerCommand.cs index 24ae583..8816f22 100644 --- a/RecrownedAthenaeum.ConsoleTools/TextureAtlasTools/TexturePackerCommand.cs +++ b/RecrownedAthenaeum.ConsoleTools/TextureAtlasTools/TexturePackerCommand.cs @@ -64,12 +64,17 @@ namespace RecrownedAthenaeum.Tools.TextureAtlasTools if (input == "q") return; if (input.Length == 0) break; } while (!int.TryParse(input, out mp)); + } else { + int indexOfInputArg = IndexOfArgumentIn("-i", arguments); + if (indexOfInputArg + 1 >= arguments.Length) throw new ArgumentException("-i is not followed by input path."); path = arguments[1 + IndexOfArgumentIn("-i", arguments)]; int.TryParse(arguments[IndexOfArgumentIn("-mp", arguments) + 1], out mp); int.TryParse(arguments[IndexOfArgumentIn("-sp", arguments) + 1], out sp); + int indexOfOutputArg = IndexOfArgumentIn("-o", arguments); + if (indexOfOutputArg + 1 >= arguments.Length) throw new ArgumentException("-o is not followed by input path."); output = arguments[IndexOfArgumentIn("-o", arguments) + 1]; if (HasArgument("-dau", arguments)) dau = true; } diff --git a/RecrownedAthenaeum/RecrownedAthenaeum.csproj b/RecrownedAthenaeum/RecrownedAthenaeum.csproj index bce03d0..6f1069e 100644 --- a/RecrownedAthenaeum/RecrownedAthenaeum.csproj +++ b/RecrownedAthenaeum/RecrownedAthenaeum.csproj @@ -89,7 +89,6 @@ - {b38f9812-b1d1-4bfe-89ee-fc4dd4ebaa3f}