Fix warp send nullcheck

@punchready reported that there was an issue with the /warp send command
checking for position != (0,0). I tried to figure out what was going on
here, and I came up dry. I think this is vestigial from some other
database or file format storage. When @MarioE converted everything to
the new warp system, he preserved the check. The problem is that the
check seems to be based on the idea that a non-existent warp would
return the default constructor (which would contain Point.Zero).
Instead, a warp not found returns a null now.

Therefore, the proper thing to do, as implied by @punchready, is to
simply nullcheck this value instead.
This commit is contained in:
Lucas Nicodemus 2021-06-13 00:14:32 -07:00
parent eba106a6da
commit 25a7e9e83a
2 changed files with 2 additions and 1 deletions

View file

@ -22,6 +22,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* Changed the default respawn timer to 10 seconds, so as to not desynchronize from the game by default. (@hakusaro)
* Fixed `/home` allowing players to bypass the respawn timer. (@hakusaro, @moisterrific, @Arthri)
* Added the config option `SuppressPermissionFailureNotices`. When set to `true`, the server will not send warning messages to players when they fail a build permission check from `TSPlayer.HasBuildPermission` (even if `shouldWarnPlayer` is set to true. (@hakusaro)
* Fixed `/warp send` failing a nullcheck if the warp didn't exist. The previous behavior may have always been buggy or broken. In other words, sending someone to a warp that doesn't exist should result in a nicer error. (@hakusaro, @punchready)
## TShock 4.5.4
* Fixed ridiculous typo in `GetDataHandlers` which caused TShock to read the wrong field in the packet for `usingBiomeTorches`. (@hakusaro, @Arthri)

View file

@ -3137,7 +3137,7 @@ namespace TShockAPI
string warpName = args.Parameters[2];
var warp = TShock.Warps.Find(warpName);
var plr = foundplr[0];
if (warp.Position != Point.Zero)
if (warp != null)
{
if (plr.Teleport(warp.Position.X * 16, warp.Position.Y * 16))
{