Skip to content

Commit c1e47a8

Browse files
committed
fix: inheritance check
1 parent 6660997 commit c1e47a8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Scripts/Runtime/Core/CollectionsRegistry.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,17 +224,17 @@ public List<ScriptableObjectCollection> GetCollectionsByItemType(Type targetColl
224224

225225
for (int i = 0; i < collections.Count; i++)
226226
{
227-
ScriptableObjectCollection scriptableObjectCollection = collections[i];
228-
if (targetCollectionItemType.IsAssignableFrom(scriptableObjectCollection.GetItemType()))
227+
ScriptableObjectCollection col = collections[i];
228+
Type collectionItemType = col.GetItemType();
229+
if (collectionItemType != null && collectionItemType.IsAssignableFrom(targetCollectionItemType))
229230
{
230-
result.Add(scriptableObjectCollection);
231+
result.Add(col);
231232
}
232233
}
233234

234235
return result;
235236
}
236237

237-
238238
[Obsolete("Use GetCollectionByGUID(ULongGuid guid) is obsolete, please regenerate your static class")]
239239
public ScriptableObjectCollection GetCollectionByGUID(string guid)
240240
{

0 commit comments

Comments
 (0)