From 0aa4a15851479952e66fd70414fce0087bd00198 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 30 Aug 2023 04:44:40 -0700 Subject: [PATCH] Fix cgear skin import loop byte 255->0 overflow infinite loop if too many tiles are unique https://projectpokemon.org/home/forums/topic/63828-c-gear-skin-editor-crash/?do=findComment&comment=285181 --- PKHeX.Core/Saves/Substructures/Gen5/CGearBackground.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PKHeX.Core/Saves/Substructures/Gen5/CGearBackground.cs b/PKHeX.Core/Saves/Substructures/Gen5/CGearBackground.cs index d77a5216b..622b5f6f8 100644 --- a/PKHeX.Core/Saves/Substructures/Gen5/CGearBackground.cs +++ b/PKHeX.Core/Saves/Substructures/Gen5/CGearBackground.cs @@ -231,12 +231,12 @@ public sealed class CGearBackground private static void FindPossibleRotatedTile(Tile t, IList tilelist, TileMap tm, int tileIndex) { // Test all tiles currently in the list - for (byte i = 0; i < tilelist.Count; i++) + for (int i = 0; i < tilelist.Count; i++) { var rotVal = t.GetRotationValue(tilelist[i].ColorChoices); if (rotVal == Tile.ROTATION_BAD) continue; - tm.TileChoices[tileIndex] = i; + tm.TileChoices[tileIndex] = (byte)i; tm.Rotations[tileIndex] = rotVal; return; }