Skip to content

Commit

Permalink
Fix Vanilla Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommy-XL committed Mar 1, 2025
1 parent c224431 commit df66d93
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 9 additions & 1 deletion Patches/AprilFoolsModePatch.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using static CosmeticsLayer;

Expand Down Expand Up @@ -126,7 +127,14 @@ public static bool LongBoyStart_Prefix(LongBoiPlayerBody __instance)
}
return false;
}

// Fix System.IndexOutOfRangeException: Index was outside the bounds of the array
// When colorIndex is 255 them heightsPerColor[255] gets exception
[HarmonyPatch(nameof(LongBoiPlayerBody.SetHeightFromColor))]
[HarmonyPrefix]
public static bool SetHeightFromColor_Prefix(int colorIndex)
{
return colorIndex != byte.MaxValue;
}
[HarmonyPatch(nameof(LongBoiPlayerBody.SetHeighFromDistanceHnS))]
[HarmonyPrefix]
public static bool LongBoyNeckSize_Prefix(LongBoiPlayerBody __instance, ref float distance)
Expand Down
8 changes: 6 additions & 2 deletions Patches/LobbyPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,13 @@ public static void Update_Postfix(LobbyBehaviour __instance)
public static class HostInfoPanelUpdatePatch
{
private static TextMeshPro HostText;
public static bool Prefix()
public static bool Prefix(HostInfoPanel __instance)
{
return GameStates.IsLobby;
if (!GameStates.IsLobby) return false;

// Fix System.IndexOutOfRangeException: Index was outside the bounds of the array.
// When __instance.player.ColorId is 255 them ColorUtility.ToHtmlStringRGB(Palette.PlayerColors[255]) gets exception
return __instance.player.ColorId != byte.MaxValue;
}
public static void Postfix(HostInfoPanel __instance)
{
Expand Down

0 comments on commit df66d93

Please sign in to comment.