From 658492a1648dbf4eacb578d09a41201853465ea0 Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Mon, 21 May 2018 15:12:55 +0930 Subject: [PATCH 1/2] Initialize PlayerData on connect This way every player has non-null player data. Should close #1460 Requires testing --- TShockAPI/GetDataHandlers.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index d8c47b3b..1a88347e 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1714,6 +1714,8 @@ namespace TShockAPI var account = TShock.UserAccounts.GetUserAccountByName(args.Player.Name); args.Player.DataWhenJoined = new PlayerData(args.Player); args.Player.DataWhenJoined.CopyCharacter(args.Player); + args.Player.PlayerData = new PlayerData(args.Player); + args.Player.PlayerData.CopyCharacter(args.Player); if (account != null && !TShock.Config.DisableUUIDLogin) { From beb0a5ce0d247bdd2ac26e29fee4e0094b66d8b5 Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Wed, 23 May 2018 11:55:26 +0930 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3ad3bfa..9ca7be14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,6 +84,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Fixed erroneous kicks and bans when using `KickOnMediumcoreDeath` and `BanOnMediumcoreDeath` options. (@DankRank) * Removed `TSPlayer.InitSpawn` field. (@DankRank) * `OnPlayerSpawn`'s player ID field is now `PlayerId`. (@DankRank) +* Fixed null reference console spam in non-SSC mode (@QuiCM) ## TShock 4.3.25 * Fixed a critical exploit in the Terraria protocol that could cause massive unpreventable world corruption as well as a number of other problems. Thanks to @bartico6 for reporting. Fixed by the efforts of @QuiCM, @hakusaro, and tips in the right directioon from @bartico6.