Skip to content

Commit

Permalink
Check if NPC and Player are valid before allowing tags to continue.
Browse files Browse the repository at this point in the history
  • Loading branch information
aufdemrand committed Jul 2, 2013
1 parent 165fc99 commit 82a5161
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/net/aufdemrand/denizen/tags/core/NPCTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ public void npcTags(ReplaceableTagEvent event) {
return;
}


if (n == null || !n.isValid()) {
dB.echoDebug("Invalid or missing player for tag <" + event.raw_tag + ">!");
event.setReplaced("null");
return;
}

event.setReplaced(n.getAttribute(attribute.fulfill(1)));

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ public void playerTags(ReplaceableTagEvent event) {
return;
}

if (p == null || !p.isValid()) {
dB.echoDebug("Invalid or missing player for tag <" + event.raw_tag + ">!");
event.setReplaced("null");
return;
}

event.setReplaced(p.getAttribute(attribute.fulfill(1)));
}

Expand Down

0 comments on commit 82a5161

Please sign in to comment.