Skip to content

Commit 111f79d

Browse files
authored
Merge pull request #57 from Thundernerd/fix/GetOrAddNew_nullref
Changed .First() to .FirstOrDefault()
2 parents 09473a5 + ac114ea commit 111f79d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Scripts/Runtime/ScriptableObjectCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ public ObjectType GetOrAddNew(Type collectionType, string targetName)
442442

443443
public ObjectType GetOrAddNew(string targetName)
444444
{
445-
ObjectType item = Items.First(o => o.name.Equals(targetName, StringComparison.Ordinal)) as ObjectType;
445+
ObjectType item = Items.FirstOrDefault(o => o.name.Equals(targetName, StringComparison.Ordinal)) as ObjectType;
446446
if (item != null)
447447
return item;
448448

0 commit comments

Comments
 (0)