Skip to content

Commit 8fecd44

Browse files
committed
Fix some /home errors with invalid data.
1 parent 2ee590d commit 8fecd44

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Essentials/src/com/earth2me/essentials/EssentialsConf.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,8 @@ public boolean hasProperty(final String path)
405405

406406
public Location getLocation(final String path, final Server server) throws InvalidWorldException
407407
{
408-
final String worldName = getString((path == null ? "" : path + ".") + "world");
408+
final String worldString = (path == null ? "" : path + ".") + "world";
409+
final String worldName = getString(worldString);
409410
if (worldName == null || worldName.isEmpty())
410411
{
411412
return null;

Essentials/src/com/earth2me/essentials/UserData.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ private String getHomeName(String search)
142142
catch (NumberFormatException e)
143143
{
144144
}
145+
catch (IndexOutOfBoundsException e)
146+
{
147+
}
145148
}
146149
return search;
147150
}

Essentials/src/com/earth2me/essentials/commands/Commandhome.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ private String getHomeLimit(final User player)
109109
}
110110

111111
private void goHome(final User user, final User player, final String home, final Trade charge) throws Exception
112-
{
112+
{
113+
if (home.length() < 1)
114+
{
115+
throw new NotEnoughArgumentsException();
116+
}
113117
final Location loc = player.getHome(home);
114118
if (loc == null)
115119
{

0 commit comments

Comments
 (0)