Avoid NPE

This commit is contained in:
Magnus Ulf 2019-02-10 19:21:46 +01:00
parent c1ef7eda9e
commit ad2131491b
2 changed files with 4 additions and 2 deletions

View File

@ -252,6 +252,7 @@ public class MoneyMixinVault extends MoneyMixinAbstract
public static Object getEconomyObject(String accountId) public static Object getEconomyObject(String accountId)
{ {
if (null == accountId) return null;
// Because of Factions we have this crazy-workaround. // Because of Factions we have this crazy-workaround.
// Where offlineplayers will be used when possible // Where offlineplayers will be used when possible
// but otherwise names will. // but otherwise names will.

View File

@ -70,7 +70,6 @@ public class SenderColl<E extends SenderEntity<E>> extends Coll<E> implements Se
@Override @Override
public String fixId(Object oid) public String fixId(Object oid)
{ {
// A null oid should always return null.
if (oid == null) throw new NullPointerException("oid"); if (oid == null) throw new NullPointerException("oid");
String ret = null; String ret = null;
@ -87,9 +86,11 @@ public class SenderColl<E extends SenderEntity<E>> extends Coll<E> implements Se
if (ret == null) if (ret == null)
{ {
// Always lower case. // Always lower case.
return IdUtil.getId(oid); ret = IdUtil.getId(oid);
} }
if (ret == null) throw new NullPointerException("Could not fix: " + oid);
if (this.isLowercasing()) if (this.isLowercasing())
{ {
ret = ret.toLowerCase(); ret = ret.toLowerCase();