CyanLaser/CyanEmu

GetPlayerByID throws exception when playerID is not in players Dictionary

Guribo opened this issue · 2 comments

When trying to get a player by an invalid ID e.g. -1 it throws an exception instead of returning null.

Issue:
image

return players[playerID];

Solution:

        public static VRCPlayerApi GetPlayerByID(int playerID)
        {
            return players.TryGetValue(playerID, out var player) ? player : null;
        }

Thank you for reporting this. I have implemented a fix in da7b431.

Thanks!