Skip to content

Commit

Permalink
Made error handling slightly better.
Browse files Browse the repository at this point in the history
  • Loading branch information
Esper89 committed Jun 16, 2023
1 parent 46c0f69 commit 18d03a8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Terrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 18d03a8

Please sign in to comment.