From 18d03a88bdec4d625003488de47fe5b994d6caae Mon Sep 17 00:00:00 2001 From: Esper Thomson Date: Fri, 16 Jun 2023 03:47:42 -0400 Subject: [PATCH] Made error handling slightly better. --- src/Terrain.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Terrain.cs b/src/Terrain.cs index ac7a6cc..010ff8a 100644 --- a/src/Terrain.cs +++ b/src/Terrain.cs @@ -233,9 +233,7 @@ public static void Patch(BinaryWriter target, BinaryReader original, BinaryReade if (patchedOctreeCount > Constants.OCTREES_PER_BATCH) { - throw new InvalidDataException( - "A patch contains more octrees than the batch can contain." - ); + Mod.LogWarning("Patch contains more octrees than the batch can contain."); } // An array of byte arrays. Each byte array is the binary node data for one octree. @@ -263,13 +261,15 @@ public static void Patch(BinaryWriter target, BinaryReader original, BinaryReade } catch (EndOfStreamException) { + Mod.LogWarning("Patch ended too early."); break; } catch (IndexOutOfRangeException) { - throw new InvalidDataException( - "A patch contains an octree outside the bounds of the batch it applies to." + Mod.LogWarning( + "Patch contains an octree outside the bounds of the batch it applies to." ); + continue; } }