WarsmashModEngine icon indicating copy to clipboard operation
WarsmashModEngine copied to clipboard

Projectile Listener onHit Crash

Open Retera opened this issue 1 year ago • 0 comments

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)

Retera avatar Dec 17 '23 02:12 Retera