[HOTFIX] Fix server crash when gangwar player leaves server
This commit is contained in:
@@ -210,11 +210,12 @@ namespace ReallifeGamemode.Server.Gangwar
|
|||||||
|
|
||||||
public void enter(Player client)
|
public void enter(Player client)
|
||||||
{
|
{
|
||||||
|
User user = client.GetUser();
|
||||||
if (this.status == "attack")
|
if (this.status == "attack")
|
||||||
{
|
{
|
||||||
if (client.GetUser().Faction.Name != getOwner() && client.GetUser().Faction.Name != getAttacker())
|
if (user.Faction.Name != getOwner() && user.Faction.Name != getAttacker())
|
||||||
return;
|
return;
|
||||||
Player gPlayer = playerInGangwar.Where(c => c.GetUser().Id == client.GetUser().Id).FirstOrDefault();
|
Player gPlayer = playerInGangwar.Where(c => c != null && !c.Handle.IsNull && c.IsLoggedIn() && c.GetUser().Id == user.Id).FirstOrDefault();
|
||||||
if (gPlayer == null)
|
if (gPlayer == null)
|
||||||
{
|
{
|
||||||
using (var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
@@ -226,6 +227,7 @@ namespace ReallifeGamemode.Server.Gangwar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (playerInside.Find(c => c == client) == null)
|
if (playerInside.Find(c => c == client) == null)
|
||||||
{
|
{
|
||||||
playerInside.Add(client);
|
playerInside.Add(client);
|
||||||
|
|||||||
Reference in New Issue
Block a user