summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Schepp <schneeleo@gmail.com>2012-06-22 19:16:40 +0300
committerAlexander Schepp <schneeleo@gmail.com>2012-06-22 19:16:40 +0300
commit2c6a81a916419c76b13d2b761c5bb00eee3f9307 (patch)
tree58a4b03aa05d461dfd036d89cc7f98d4167ef10d
parent329f93a4f67de40f3a382cd6dec91a814f679eb4 (diff)
downloadEssentials-2c6a81a916419c76b13d2b761c5bb00eee3f9307.tar
Essentials-2c6a81a916419c76b13d2b761c5bb00eee3f9307.tar.gz
Essentials-2c6a81a916419c76b13d2b761c5bb00eee3f9307.tar.lz
Essentials-2c6a81a916419c76b13d2b761c5bb00eee3f9307.tar.xz
Essentials-2c6a81a916419c76b13d2b761c5bb00eee3f9307.zip
Prevent NPEs in KeywordReplacer
-rw-r--r--Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java8
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
{