Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update CleanupModule.cs
  • Loading branch information
SplenectomY authored Aug 23, 2018
commit 970ab4ee61c9cc6eb2f4b082ff7ff00a5d71fda8
7 changes: 4 additions & 3 deletions Essentials/Commands/CleanupModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public bool PlayerDistanceLessThan(MyCubeGrid grid, double dist)
[Condition("ownedby", helpText: "Finds grids owned by the given player. Can specify player name, IdentityId, 'nobody', or 'pirates'.")]
public bool OwnedBy(MyCubeGrid grid, string str)
{
long identityId = null;
long identityId;

if (string.Compare(str, "nobody", StringComparison.InvariantCultureIgnoreCase) == 0)
{
Expand All @@ -284,15 +284,16 @@ public bool OwnedBy(MyCubeGrid grid, string str)
if(long.TryParse(str, out long NPCId))
{
if(MySession.Static.Players.IdentityIsNpc(NPCId))
{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll get a null reference exception if this statement is false. Remove the else on L291

return grid.BigOwners.Contains(NPCId);
}
}
else
{
return false;
}

identityId = player.IdentityId;
}
identityId = player.IdentityId;
}

return grid.BigOwners.Contains(identityId);
Expand Down