Change order in UPlayer.detachId to avoid NPE.
This commit is contained in:
parent
09a23353a7
commit
0ed104279f
@ -42,16 +42,19 @@ public class UPlayerColl extends SenderColl<UPlayer>
|
|||||||
@Override
|
@Override
|
||||||
public UPlayer detachId(Object oid)
|
public UPlayer detachId(Object oid)
|
||||||
{
|
{
|
||||||
UPlayer ret = super.detachId(oid);
|
UPlayer ret = this.get(oid);
|
||||||
if (ret == null) return null;
|
if (ret == null) return null;
|
||||||
|
|
||||||
// If inited ...
|
// If inited ...
|
||||||
if (!this.inited()) return ret;
|
if (this.inited())
|
||||||
|
{
|
||||||
// ... update the index.
|
// ... update the index.
|
||||||
Faction faction = ret.getFaction();
|
Faction faction = ret.getFaction();
|
||||||
faction.uplayers.remove(ret);
|
faction.uplayers.remove(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
super.detachId(oid);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,6 +138,7 @@ public class FactionsListenerEcon implements Listener
|
|||||||
}
|
}
|
||||||
else if (event.getReason() == MembershipChangeReason.LEAVE)
|
else if (event.getReason() == MembershipChangeReason.LEAVE)
|
||||||
{
|
{
|
||||||
|
// TODO: NPE once occurred on line below.
|
||||||
cost = UConf.get(event.getSender()).econCostLeave;
|
cost = UConf.get(event.getSender()).econCostLeave;
|
||||||
desc = "leave a faction";
|
desc = "leave a faction";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user