Skip to content

Commit

Permalink
Exception when using mixed uv counts
Browse files Browse the repository at this point in the history
Guarded against copying UV/UV2/UV3/UV4 when mesh did not have the
coordinates but the array was not null.
  • Loading branch information
Jaimi committed Jan 23, 2016
1 parent c3e7bc7 commit 45af7e8
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public static void CombineMeshes(UMAMeshData target, CombineInstance[] sources)
}
if (has_uv)
{
if (source.meshData.uv != null)
if (source.meshData.uv != null && source.meshData.uv.Length >= vertexCount)
{
Array.Copy(source.meshData.uv, 0, uv, vertexIndex, vertexCount);
}
Expand All @@ -144,7 +144,7 @@ public static void CombineMeshes(UMAMeshData target, CombineInstance[] sources)
}
if (has_uv2)
{
if (source.meshData.uv2 != null)
if (source.meshData.uv2 != null && source.meshData.uv2.Length >= vertexCount)
{
Array.Copy(source.meshData.uv2, 0, uv2, vertexIndex, vertexCount);
}
Expand All @@ -156,7 +156,7 @@ public static void CombineMeshes(UMAMeshData target, CombineInstance[] sources)
#if !UNITY_4_6
if (has_uv3)
{
if (source.meshData.uv3 != null)
if (source.meshData.uv3 != null && source.meshData.uv3.Length >= vertexCount)
{
Array.Copy(source.meshData.uv3, 0, uv3, vertexIndex, vertexCount);
}
Expand All @@ -167,7 +167,7 @@ public static void CombineMeshes(UMAMeshData target, CombineInstance[] sources)
}
if (has_uv4)
{
if (source.meshData.uv4 != null)
if (source.meshData.uv4 != null && source.meshData.uv4.Length >= vertexCount)
{
Array.Copy(source.meshData.uv4, 0, uv4, vertexIndex, vertexCount);
}
Expand Down

0 comments on commit 45af7e8

Please sign in to comment.