From d5d039e29c814ff0a821f2319ccbfc6ebff9e6d9 Mon Sep 17 00:00:00 2001 From: Aleksander Waage Date: Sun, 23 Aug 2020 12:53:11 +0200 Subject: [PATCH] null checks --- QSB/PlayerRegistry.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/QSB/PlayerRegistry.cs b/QSB/PlayerRegistry.cs index f3691b13..402ebd3f 100644 --- a/QSB/PlayerRegistry.cs +++ b/QSB/PlayerRegistry.cs @@ -61,12 +61,12 @@ namespace QSB public static IEnumerable GetSyncObjects() where T : PlayerSyncObject { - return PlayerSyncObjects.OfType(); + return PlayerSyncObjects.OfType().Where(x => x != null); } public static T GetSyncObject(uint id) where T : PlayerSyncObject { - return GetSyncObjects().FirstOrDefault(x => x.NetId == id); + return GetSyncObjects().FirstOrDefault(x => x != null && x.NetId == id); } public static bool IsBelongingToLocalPlayer(uint id)