fix: in rare cases, an IndexOutOfRangeException is thrown

This commit is contained in:
mob-sakai
2020-10-28 12:18:39 +09:00
parent f2c78e3ae4
commit f7eac0a34f

View File

@@ -256,6 +256,7 @@ namespace Coffee.UIExtensions
// 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());
@@ -266,7 +267,7 @@ namespace Coffee.UIExtensions
// 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);