Prevent NPE in recent clan chats when var is null

RECENT_CLAN_CHAT can be null when reset, so move the jagex name
sanitization to updateRecentChat method (after null check).

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-10-24 12:03:00 +02:00
parent 2d7a66ed1c
commit a0dc0e97da

View File

@@ -133,7 +133,7 @@ public class ClanChatPlugin extends Plugin
{
if (strChanged.getIndex() == VarClientStr.RECENT_CLAN_CHAT.getIndex() && config.recentChats())
{
updateRecentChat(Text.toJagexName(client.getVar(VarClientStr.RECENT_CLAN_CHAT)));
updateRecentChat(client.getVar(VarClientStr.RECENT_CLAN_CHAT));
}
}
@@ -215,6 +215,8 @@ public class ClanChatPlugin extends Plugin
return;
}
s = Text.toJagexName(s);
chats.removeIf(s::equalsIgnoreCase);
chats.add(s);