Skip to content

Commit

Permalink
Merge pull request #5474 from TownyAdvanced/fix/bankrupt-npe
Browse files Browse the repository at this point in the history
Fix possible npe when checking bankrupt status.
  • Loading branch information
LlmDl authored Nov 28, 2021
2 parents aac6916 + f349776 commit 114ad12
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,11 @@ protected boolean addMoney(double amount) {
* @return true if in debt, false otherwise.
*/
public boolean isBankrupt() {
if (isTownAccount())
return getTown().isBankrupt();
if (isTownAccount()) {
Town town = getTown();
return town != null && town.isBankrupt();
}

return false;
}

Expand Down

0 comments on commit 114ad12

Please sign in to comment.