Skip to content

Commit b3fc66f

Browse files
committed
Bugfix: Prevent NPE if damage stack is empty when something dies
1 parent aae6c93 commit b3fc66f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/kotlin/api/api/combat/death/DeathHookHandler.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ object DeathHookHandler {
104104
* @param source The [Mob] responsible for the kill.
105105
* @param stage The current [DeathStage] of the death sequence.
106106
*/
107-
fun onDeath(victim: Mob, source: Mob, stage: DeathStage) {
107+
fun onDeath(victim: Mob, source: Mob?, stage: DeathStage) {
108108
if (victim is Npc) {
109109
val receiver = DeathHookReceiver(victim, source, stage)
110110
val lookup = npcHooks[victim.id]

src/main/kotlin/api/api/combat/death/dsl/DeathHookReceiver.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import io.luna.game.model.mob.MobDeathTask.DeathStage
4141
* @property source The entity responsible for causing the death.
4242
* @property stage The current death stage ([DeathStage.PRE_DEATH], [DeathStage.DEATH], [DeathStage.POST_DEATH]).
4343
*/
44-
class DeathHookReceiver<T : Mob>(val victim: T, val source: Mob, private val stage: DeathStage) {
44+
class DeathHookReceiver<T : Mob>(val victim: T, val source: Mob?, private val stage: DeathStage) {
4545

4646
/**
4747
* Executes logic during the pre-death stage. This block runs before the entity officially dies.

0 commit comments

Comments
 (0)