Skip to content

Commit

Permalink
[csharp] Fixed "rgb2" timeline "light" color failing to read when hav…
Browse files Browse the repository at this point in the history
…ing hexstring length 8 instead of 6. Closes EsotericSoftware#2476.
  • Loading branch information
HaraldCsaszar committed Mar 7, 2024
1 parent b9b6e0d commit 3b8069f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spine-csharp/src/SkeletonJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1232,8 +1232,8 @@ static string GetString (Dictionary<string, Object> map, string name, string def
}

static float ToColor (string hexString, int colorIndex, int expectedLength = 8) {
if (hexString.Length != expectedLength)
throw new ArgumentException("Color hexidecimal length must be " + expectedLength + ", recieved: " + hexString, "hexString");
if (hexString.Length < expectedLength)
throw new ArgumentException("Color hexadecimal length must be " + expectedLength + ", received: " + hexString, "hexString");
return Convert.ToInt32(hexString.Substring(colorIndex * 2, 2), 16) / (float)255;
}
}
Expand Down

0 comments on commit 3b8069f

Please sign in to comment.