mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-18 13:23:05 +00:00
null checks
This commit is contained in:
parent
b0d26b9b44
commit
d5d039e29c
@ -61,12 +61,12 @@ namespace QSB
|
|||||||
|
|
||||||
public static IEnumerable<T> GetSyncObjects<T>() where T : PlayerSyncObject
|
public static IEnumerable<T> GetSyncObjects<T>() where T : PlayerSyncObject
|
||||||
{
|
{
|
||||||
return PlayerSyncObjects.OfType<T>();
|
return PlayerSyncObjects.OfType<T>().Where(x => x != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static T GetSyncObject<T>(uint id) where T : PlayerSyncObject
|
public static T GetSyncObject<T>(uint id) where T : PlayerSyncObject
|
||||||
{
|
{
|
||||||
return GetSyncObjects<T>().FirstOrDefault(x => x.NetId == id);
|
return GetSyncObjects<T>().FirstOrDefault(x => x != null && x.NetId == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsBelongingToLocalPlayer(uint id)
|
public static bool IsBelongingToLocalPlayer(uint id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user