Skip to content

Commit

Permalink
Fix NPE in dPlayer's <…chat_history> when player hasn't chatted.
Browse files Browse the repository at this point in the history
  • Loading branch information
aufdemrand committed Aug 18, 2013
1 parent 35ea625 commit fd5d855
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/net/aufdemrand/denizen/objects/dPlayer.java
Expand Up @@ -339,8 +339,9 @@ else if (attribute.startsWith("list.offline")) {
int x = 1;
if (attribute.hasContext(1) && aH.matchesInteger(attribute.getContext(1)))
x = attribute.getIntContext(1);

return new Element(PlayerTags.playerChatHistory.get(player_name).get(x - 1))
// No playerchathistory? Return null.
if (!PlayerTags.playerChatHistory.containsKey(player_name)) return "null";
else return new Element(PlayerTags.playerChatHistory.get(player_name).get(x - 1))
.getAttribute(attribute.fulfill(1));
}

Expand Down

0 comments on commit fd5d855

Please sign in to comment.