Skip to content

fix: null check sur getPlayerCity() dans calculatePlayerInterest()#1215

Merged
iambibi merged 1 commit intoServerOpenMC:masterfrom
gtolontop:fix/null-check-calculatePlayerInterest
Mar 22, 2026
Merged

fix: null check sur getPlayerCity() dans calculatePlayerInterest()#1215
iambibi merged 1 commit intoServerOpenMC:masterfrom
gtolontop:fix/null-check-calculatePlayerInterest

Conversation

@gtolontop
Copy link
Contributor

Corrige le NPE dans calculatePlayerInterest() quand un joueur n'appartient à aucune ville.

Problème

Dans BankManager.calculatePlayerInterest(), CityManager.getPlayerCity(playerUUID) était appelé sans vérification de null, puis .getMayor() était directement invoqué dessus. Si le joueur n'a pas de ville, cela provoquait un NullPointerException à chaque tick d'intérêt.

Correction

  • Extraction du résultat de getPlayerCity() dans une variable locale
  • Ajout d'un null check avec short-circuit (city != null &&) avant d'accéder à getMayor()

Fixes #1166

@iambibi iambibi added this to the 2.2.9 milestone Mar 22, 2026
@iambibi iambibi added the ✨ Fixes Quelque chose a été patch label Mar 22, 2026
@iambibi iambibi merged commit 53688e6 into ServerOpenMC:master Mar 22, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Fixes Quelque chose a été patch

Projects

None yet

2 participants