[HOTFIX] fix some nullreferences

This commit is contained in:
hydrant
2021-04-11 22:35:03 +02:00
parent ae90c82855
commit 231edc71d9
3 changed files with 30 additions and 22 deletions

View File

@@ -31,8 +31,9 @@ namespace ReallifeGamemode.Server.Extensions
/// <returns></returns>
public static User GetUser(this Player client, DatabaseContext context = null)
{
context = context ?? new DatabaseContext();
if (!client.IsLoggedIn()) return null;
context = context ?? new DatabaseContext();
return context
.Users
.Include(u => u.Faction)