From ce27bdcd53b46f736570eee844e69bae27438bf9 Mon Sep 17 00:00:00 2001 From: Haven1433 Date: Mon, 29 Aug 2022 20:49:29 -0500 Subject: [PATCH] trainers must have at least 1 pokemon other arrays are limited to have at least 1 element, add that limit for trainer teams as well --- src/HexManiac.Core/Models/Runs/TrainerPokemonTeamRun.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/HexManiac.Core/Models/Runs/TrainerPokemonTeamRun.cs b/src/HexManiac.Core/Models/Runs/TrainerPokemonTeamRun.cs index 3679bacc..9ce3a45c 100644 --- a/src/HexManiac.Core/Models/Runs/TrainerPokemonTeamRun.cs +++ b/src/HexManiac.Core/Models/Runs/TrainerPokemonTeamRun.cs @@ -514,6 +514,7 @@ namespace HavenSoft.HexManiac.Core.Models.Runs { var newStructType = model[pointerSource - TrainerFormat_PointerOffset]; var newElementCount = model[pointerSource - TrainerFormat_PointerOffset + TrainerFormat_PokemonCountOffset]; + newElementCount = Math.Max(newElementCount, (byte)1); var newRun = this; if (newElementCount != ElementCount) newRun = (TrainerPokemonTeamRun)newRun.Append(token, newElementCount - ElementCount);