Skip to content

Commit

Permalink
fix: in rare cases, an IndexOutOfRangeException is thrown
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Oct 28, 2020
1 parent f2c78e3 commit f7eac0a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Scripts/UIParticle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ protected override void UpdateMaterial()

// Main
var index = i * 2;
if (activeMeshIndices.Count <= index) break;
if (activeMeshIndices[index] && 0 < s_TempMaterials.Count)
{
var mat = GetModifiedMaterial(s_TempMaterials[0], ps.GetTextureForSprite());
Expand All @@ -266,7 +267,7 @@ protected override void UpdateMaterial()

// Trails
index++;
if (materialCount <= j) break;
if (activeMeshIndices.Count <= index || materialCount <= j) break;
if (activeMeshIndices[index] && 1 < s_TempMaterials.Count)
{
var mat = GetModifiedMaterial(s_TempMaterials[1], null);
Expand Down

0 comments on commit f7eac0a

Please sign in to comment.