Terasology / LightAndShadow

Light & Shadow is an experimental game type set in a quirky Alice in Wonderland inspired setting
Apache License 2.0
8 stars 22 forks source link

Crash in PlayerDeathSystem while trying to update statistics #234

Closed skaldarnar closed 2 years ago

skaldarnar commented 3 years ago

During play-testing https://github.com/MovingBlocks/Terasology/releases/tag/v5.2.0-rc.1 the (headless) server crashed due to the following NPE when updating the player statistics:

java.lang.NullPointerException: null
        at org.terasology.ligthandshadow.componentsystem.controllers.PlayerDeathSystem.updateStatistics(PlayerDeathSystem.java:93)
        at org.terasology.ligthandshadow.componentsystem.controllers.PlayerDeathSystem.beforeDestroy(PlayerDeathSystem.java:63)
        at org.terasology.ligthandshadow.componentsystem.controllers.PlayerDeathSystemMethodAccess.invoke(Unknown Source)
        at org.terasology.engine.entitySystem.event.internal.EventSystemImpl$ByteCodeEventHandlerInfo.invoke(EventSystemImpl.java:379)
        at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.sendConsumableEvent(EventSystemImpl.java:254)
        at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.send(EventSystemImpl.java:233)
        at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67

This occurs when the player does not have a PlayerStatisticsComponent.

https://github.com/Terasology/LightAndShadow/blob/8c937cdc727b3e342523c45020c3ffc66eb2c765/src/main/java/org/terasology/ligthandshadow/componentsystem/controllers/PlayerDeathSystem.java#L90-L99

jdrueckert commented 2 years ago

Release v5.2.0

jdrueckert commented 2 years ago

Fixed by #242