sanitize text for Jagex non-breaking spaces (#1697)

add null check player name
This commit is contained in:
Netami1
2019-10-01 12:24:05 -04:00
committed by Ganom
parent c1e24e8188
commit b51a1cd249

View File

@@ -217,12 +217,19 @@ public class CoxPlugin extends Plugin
{ {
for (Player player : client.getPlayers()) for (Player player : client.getPlayers())
{ {
if (player.getName().equals(tpMatcher.group(1))) final String rawPlayerName = player.getName();
if (rawPlayerName != null)
{
final String fixedPlayerName = Text.sanitize(rawPlayerName);
if (fixedPlayerName.equals(tpMatcher.group(1)))
{ {
victims.add(new Victim(player, Victim.Type.TELEPORT)); victims.add(new Victim(player, Victim.Type.TELEPORT));
} }
} }
} }
}
switch (Text.standardize(event.getMessageNode().getValue())) switch (Text.standardize(event.getMessageNode().getValue()))
{ {