Retera / WarsmashModEngine

An emulation engine to improve Warcraft III modding
GNU Affero General Public License v3.0
192 stars 37 forks source link

Projectile Listener onHit Crash #58

Open Retera opened 6 months ago

Retera commented 6 months ago

I was playing a slightly out-of-date code version and encountered this game crash bug when a missile landed on a unit that was probably a dead unit. I had a Warden selected and was trying to use Shadow Strike on a creep right as it died in a melee match. I also had a few archers selected. Looks like we need a null check on the onHit callback of the projectile. I would add it myself, but was busy at this particular moment. I might fix this in a few days if no one else does.

Exception in thread "LWJGL Application" java.lang.NullPointerException: Cannot invoke "com.etheller.warsmash.viewer5.handlers.w3x.simulation.CUnit.isHero()" because "tar" is null
        at com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilitybuilder.behavior.callback.floatcallbacks.ABCallbackGetAbilityDuration.callback(ABCallbackGetAbilityDuration.java:23)
        at com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilitybuilder.behavior.condition.numeric.ABConditionFloatEqual.evaluate(ABConditionFloatEqual.java:17)
        at com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilitybuilder.behavior.action.structural.ABActionIf.runAction(ABActionIf.java:18)
        at com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilitybuilder.projectile.ABProjectileListener.onHit(ABProjectileListener.java:51)
        at com.etheller.warsmash.viewer5.handlers.w3x.simulation.combat.projectile.CAbilityProjectile.onHitTarget(CAbilityProjectile.java:18)
        at com.etheller.warsmash.viewer5.handlers.w3x.simulation.combat.projectile.CProjectile.update(CProjectile.java:60)
        at com.etheller.warsmash.viewer5.handlers.w3x.simulation.CSimulation.update(CSimulation.java:466)
        at com.etheller.warsmash.viewer5.handlers.w3x.War3MapViewer.update(War3MapViewer.java:2382)
        at com.etheller.warsmash.viewer5.ModelViewer.updateAndRender(ModelViewer.java:275)
        at com.etheller.warsmash.WarsmashGdxMapScreen.render(WarsmashGdxMapScreen.java:288)
        at com.badlogic.gdx.Game.render(Game.java:46)
        at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:259)
        at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:138)