diff --git a/spine-csharp/src/SkeletonBinary.cs b/spine-csharp/src/SkeletonBinary.cs index fe535a8a6..3e5695f0d 100644 --- a/spine-csharp/src/SkeletonBinary.cs +++ b/spine-csharp/src/SkeletonBinary.cs @@ -1236,7 +1236,7 @@ namespace Spine { input.Position = initialPosition; return GetVersionStringOld3X(); } catch (Exception e) { - throw new ArgumentException("Stream does not contain a valid binary Skeleton Data.\n" + e, "input"); + throw new ArgumentException("Stream does not contain valid binary Skeleton Data.\n" + e, "input"); } } @@ -1248,13 +1248,13 @@ namespace Spine { // Version. byteCount = ReadInt(true); - if (byteCount > 1) { + if (byteCount > 1 && byteCount <= 13) { byteCount--; var buffer = new byte[byteCount]; ReadFully(buffer, 0, byteCount); return System.Text.Encoding.UTF8.GetString(buffer, 0, byteCount); } - return null; + throw new ArgumentException("Stream does not contain valid binary Skeleton Data."); } } }