Fix #518 Trade station crashes when new station is named after a restart

This commit is contained in:
mezz committed 2015-02-21 00:02:31 -08:00
1 parent 9536bf1b78
commit b9b71cf015
2 files changed
+11 -5

No files matched your search

@@ -82,7 +82,7 @@ public class PostRegistry implements IPostRegistry {
*/
@Override
public boolean isValidTradeAddress(World world, IMailAddress address) {
return address.isTrader() && address.getName().matches("^[a-zA-Z0-9]+$");
return address != null && address.isTrader() && address.getName().matches("^[a-zA-Z0-9]+$");
}
/**
@@ -92,12 +92,12 @@ public class PostRegistry implements IPostRegistry {
*/
@Override
public boolean isAvailableTradeAddress(World world, IMailAddress address) {
return getTradeStation(world, address) == null;
return address != null && getTradeStation(world, address) == null;
}
@Override
public TradeStation getTradeStation(World world, IMailAddress address) {
if (address.getName() == null) {
if (address == null || address.getName() == null) {
return null;
}