Pixelmon Mod - Bug tracker

[9.0.2] Attempting HeldItemCondition evolution with no held item produces NPE fix completed for upcoming version

Ticket description:
When attempting an evolution with a HeldItemCondition, while not holding anything, results in a NullPointerException due to getRegistryName#toString. The registry name is null because the held item is air when not holding anything. This can be fixed by adding in null checks into HeldItemCondition#passes.

Time: 6/14/22, 12:38 AM
Description: Ticking entity

java.lang.NullPointerException: Ticking entity
at com.pixelmonmod.pixelmon.api.pokemon.stats.evolution.conditions.HeldItemCondition.passes(HeldItemCondition.java:25) ~[pixelmon:1.16.5-9.0.2] {re:classloading}
at com.pixelmonmod.pixelmon.api.pokemon.stats.evolution.Evolution.canEvolve(Evolution.java:58) ~[pixelmon:1.16.5-9.0.2] {re:classloading}
at com.pixelmonmod.pixelmon.api.pokemon.stats.evolution.types.LevelingEvolution.canEvolve(LevelingEvolution.java:34) ~[pixelmon:1.16.5-9.0.2] {re:classloading}
at com.pixelmonmod.pixelmon.entities.pixelmon.PixelmonEntity.testLevelEvolution(PixelmonEntity.java:718) ~[pixelmon:1.16.5-9.0.2] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:runtimedistcleaner:A}
at com.pixelmonmod.pixelmon.api.pokemon.Pokemon.tryEvolution(Pokemon.java:1303) ~[pixelmon:1.16.5-9.0.2] {re:classloading,pl:runtimedistcleaner:A}
at com.pixelmonmod.pixelmon.api.pokemon.stats.PokemonLevel.awardEXP(PokemonLevel.java:244) ~[pixelmon:1.16.5-9.0.2] {re:classloading}
at com.pixelmonmod.pixelmon.battles.controller.Experience.calcExp(Experience.java:176) ~[pixelmon:1.16.5-9.0.2] {re:classloading}
at com.pixelmonmod.pixelmon.battles.controller.Experience.awardExp(Experience.java:84) ~[pixelmon:1.16.5-9.0.2] {re:classloading}
at com.pixelmonmod.pixelmon.entities.pokeballs.EmptyPokeBallEntity.catchPokemon(EmptyPokeBallEntity.java:546) ~[pixelmon:1.16.5-9.0.2] {re:classloading,pl:runtimedistcleaner:A}
at com.pixelmonmod.pixelmon.entities.pokeballs.EmptyPokeBallEntity.func_70071_h_(EmptyPokeBallEntity.java:405) ~[pixelmon:1.16.5-9.0.2] {re:classloading,pl:runtimedistcleaner:A}

Comments

#26439 Posted by Timebike » 17 Jun 2022 16:17

Any Pokemon with a HeldItemCondition can trigger this crash, I have ensured that I can reproduce this with the following Pokemon:

Gligar
Happiny
Foongus

#26442 Posted by Katzyn » 18 Jun 2022 09:12

Forwarded! Thank you!

Ticket details

  • Ticket ID: 18227
  • Project: Pixelmon Mod
  • Status: Fix completed for upcoming version
  • Component: Crash
  • Project version: 1.16.5-9.x.x
  • Priority: Normal
  • Severity: Normal
  • Forge/Sponge: (unknown)
  • What else would be useful to know?: (unknown)
  • Assigned to: Katzyn
  • Reported by: Timebike (Send PM)
  • Reporter's tickets: (List all tickets)
  • Reported on: 17 Jun 2022 16:13
  • Ticket last visited by: Sophie847 on 29 Jun 2022 04:02
JOIN THE TEAM