fix #305 empty list of tagged objects throws NRE (#306)

* fix #305 empty list of tagged objects throws NRE
* added missing indexer
This commit is contained in:
Soraphis 2021-11-28 16:03:27 +01:00 committed by GitHub
parent 8c1d6f215c
commit a7240651f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -199,6 +199,7 @@ namespace UnityAtoms.Tags
public static GameObject FindByTag(string tag)
{
if (!TaggedGameObjects.ContainsKey(tag)) return null;
if (TaggedGameObjects[tag].Count < 1) return null;
return TaggedGameObjects[tag][0];
}