Ver código fonte

[csharp] Minor bugfix of binary 3.8 version fallback reading logic.

Harald Csaszar 3 anos atrás
pai
commit
559af1159b
1 arquivos alterados com 3 adições e 3 exclusões
  1. 3 3
      spine-csharp/src/SkeletonBinary.cs

+ 3 - 3
spine-csharp/src/SkeletonBinary.cs

@@ -1200,7 +1200,7 @@ namespace Spine {
 					input.Position = initialPosition;
 					input.Position = initialPosition;
 					return GetVersionStringOld3X();
 					return GetVersionStringOld3X();
 				} catch (Exception e) {
 				} 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");
 				}
 				}
 			}
 			}
 
 
@@ -1212,13 +1212,13 @@ namespace Spine {
 
 
 				// Version.
 				// Version.
 				byteCount = ReadInt(true);
 				byteCount = ReadInt(true);
-				if (byteCount > 1) {
+				if (byteCount > 1 && byteCount <= 13) {
 					byteCount--;
 					byteCount--;
 					var buffer = new byte[byteCount];
 					var buffer = new byte[byteCount];
 					ReadFully(buffer, 0, byteCount);
 					ReadFully(buffer, 0, byteCount);
 					return System.Text.Encoding.UTF8.GetString(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.");
 			}
 			}
 		}
 		}
 	}
 	}