diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 80e710ad..d0c3b48a 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -825,8 +825,11 @@ namespace TShockAPI { var group = TShock.Groups.GetGroupByName(account.Group); - if (!TShock.Utils.AssertGroupValid(args.Player, group)) + if (group == null) + { + args.Player.SendErrorMessage("Login failed: The account references a group that doesn't exist."); return; + } args.Player.PlayerData = TShock.CharacterDB.GetPlayerData(args.Player, account.ID); diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs index 36a6d348..be3722df 100644 --- a/TShockAPI/Utils.cs +++ b/TShockAPI/Utils.cs @@ -212,6 +212,12 @@ namespace TShockAPI } while (TilePlacementValid(tileX, tileY) && TileSolid(tileX, tileY)); } + /// + /// Asserts that the group reference can be safely assigned to the player object. + /// + /// + /// + /// public bool AssertGroupValid(TSPlayer player, Group group) { if (group == null)