diff options
author | Alexander Schepp <schneeleo@gmail.com> | 2012-06-22 19:16:40 +0300 |
---|---|---|
committer | Alexander Schepp <schneeleo@gmail.com> | 2012-06-22 19:16:40 +0300 |
commit | 56ef52a4fa1d22e7764f21754287272a532d34d1 (patch) | |
tree | aa77299ee98482d7f83011939d286d47429e01a1 | |
parent | 9aea1029ac5c1751b35f6f996ffebc56b04eb8a1 (diff) | |
download | Essentials-56ef52a4fa1d22e7764f21754287272a532d34d1.tar Essentials-56ef52a4fa1d22e7764f21754287272a532d34d1.tar.gz Essentials-56ef52a4fa1d22e7764f21754287272a532d34d1.tar.lz Essentials-56ef52a4fa1d22e7764f21754287272a532d34d1.tar.xz Essentials-56ef52a4fa1d22e7764f21754287272a532d34d1.zip |
Prevent NPEs in KeywordReplacer
-rw-r--r-- | Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java index d79483699..d8e590300 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java +++ b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java @@ -44,10 +44,10 @@ public class KeywordReplacer implements IText address = user.getAddress().toString(); balance = Double.toString(user.getMoney()); mails = Integer.toString(user.getMails().size()); - world = user.getLocation().getWorld().getName(); - worldTime12 = DescParseTickFormat.format12(user.getWorld().getTime()); - worldTime24 = DescParseTickFormat.format24(user.getWorld().getTime()); - worldDate = DateFormat.getDateInstance(DateFormat.MEDIUM, ess.getI18n().getCurrentLocale()).format(DescParseTickFormat.ticksToDate(user.getWorld().getFullTime())); + world = user.getLocation() == null || user.getLocation().getWorld() == null ? "" : user.getLocation().getWorld().getName(); + worldTime12 = DescParseTickFormat.format12(user.getWorld() == null ? 0 : user.getWorld().getTime()); + worldTime24 = DescParseTickFormat.format24(user.getWorld() == null ? 0 : user.getWorld().getTime()); + worldDate = DateFormat.getDateInstance(DateFormat.MEDIUM, ess.getI18n().getCurrentLocale()).format(DescParseTickFormat.ticksToDate(user.getWorld() == null ? 0 : user.getWorld().getFullTime())); } else { |