fixed null pointer exceptions during save and initializing regions
This commit is contained in:
parent
7fe6cde2d9
commit
f9b1af1b19
2 changed files with 15 additions and 6 deletions
|
|
@ -69,7 +69,8 @@ namespace TShockAPI
|
|||
|
||||
foreach (TSPlayer player in TShock.Players)
|
||||
{
|
||||
if (player.IsLoggedIn)
|
||||
// prevent null point exceptions
|
||||
if (player != null && player.IsLoggedIn)
|
||||
{
|
||||
TShock.InventoryDB.InsertPlayerData(player);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -664,12 +664,20 @@ namespace TShockAPI.DB
|
|||
|
||||
public void SetAllowedGroups( String groups )
|
||||
{
|
||||
List<String> groupArr = groups.Split(',').ToList();
|
||||
|
||||
for (int i = 0; i < groupArr.Count; i++)
|
||||
groupArr[i] = groupArr[i].Trim();
|
||||
// prevent null pointer exceptions
|
||||
if (!string.IsNullOrEmpty(groups))
|
||||
{
|
||||
List<String> groupArr = groups.Split(',').ToList();
|
||||
|
||||
AllowedGroups = groupArr;
|
||||
for (int i = 0; i < groupArr.Count; i++)
|
||||
groupArr[i] = groupArr[i].Trim();
|
||||
|
||||
AllowedGroups = groupArr;
|
||||
}
|
||||
else
|
||||
{
|
||||
AllowedGroups = new List<string>();
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveID(int id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue