[BUG-Report] NullPointerException when Entity attacks while weapon has no material#90
Open
queria wants to merge 1 commit into
Open
[BUG-Report] NullPointerException when Entity attacks while weapon has no material#90queria wants to merge 1 commit into
queria wants to merge 1 commit into
Conversation
Author
|
Seems not just orcs - issued command to military group to hunt down one elephant, seems others wanted to defend/awange it ... game crashes (and yes, need to log more info about the weapon type): |
After Orcs Invaded settlement (still in the camping phase),
something started fight and game crashed.
Currently do not know what happened yet,
so attempt to get more details logged.
(Based on code i suspect it may be for example case of UNARMED weapon,
as set at start of CreatureCombat constructor while not setting
equippedWeaponQuality so would be left as null.)
ERROR: java.lang.NullPointerException: Cannot invoke "technology.rocketjump.mountaincore.entities.model.physical.item.ItemEntityAttributes.getPrimaryMaterial()" because the return value of "technology.rocketjump.mountaincore.entities.ai.combat.CreatureCombat.getEquippedWeaponAttributes()" is null
at technology.rocketjump.mountaincore.entities.ai.combat.AttackCreatureCombatAction.triggerAttack(AttackCreatureCombatAction.java:125)
at technology.rocketjump.mountaincore.entities.ai.combat.AttackCreatureCombatAction.update(AttackCreatureCombatAction.java:75)
at technology.rocketjump.mountaincore.entities.behaviour.creature.CombatBehaviour.update(CombatBehaviour.java:140)
at technology.rocketjump.mountaincore.entities.behaviour.creature.CreatureBehaviour.update(CreatureBehaviour.java:127)
at technology.rocketjump.mountaincore.entities.model.Entity.update(Entity.java:232)
at technology.rocketjump.mountaincore.entities.EntityUpdater.update(EntityUpdater.java:32)
at technology.rocketjump.mountaincore.gamecontext.GameUpdateRegister.update(GameUpdateRegister.java:32)
queria
force-pushed
the
crash-npe-attack-no-weapon-attribute
branch
from
August 10, 2025 18:36
21f55eb to
b24b0ee
Compare
Author
|
This can happen also when Dwarf freshly switched to military attempts to start training, and at least in that case it IS NOT? the case of UNARMED weapon: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
// Please consider this currently as bug report ... since there are no Issues open on this repo ... currently I have no clue yet what caused it and how it could be prevented/fixed.
After Orcs Invaded settlement (still in the camping phase), something started fight and game crashed.
Currently do not know what happened yet,
so attempt to get more details logged.
(Based on code i suspect it may be for example case of UNARMED weapon,
as set at start of CreatureCombat constructor while not setting
equippedWeaponQuality so would be left as null.)
ERROR: java.lang.NullPointerException: Cannot invoke "technology.rocketjump.mountaincore.entities.model.physical.item.ItemEntityAttributes.getPrimaryMaterial()" because the return value of "technology.rocketjump.mountaincore.entities.ai.combat.CreatureCombat.getEquippedWeaponAttributes()" is null
at technology.rocketjump.mountaincore.entities.ai.combat.AttackCreatureCombatAction.triggerAttack(AttackCreatureCombatAction.java:125)
at technology.rocketjump.mountaincore.entities.ai.combat.AttackCreatureCombatAction.update(AttackCreatureCombatAction.java:75)
at technology.rocketjump.mountaincore.entities.behaviour.creature.CombatBehaviour.update(CombatBehaviour.java:140)
at technology.rocketjump.mountaincore.entities.behaviour.creature.CreatureBehaviour.update(CreatureBehaviour.java:127)
at technology.rocketjump.mountaincore.entities.model.Entity.update(Entity.java:232)
at technology.rocketjump.mountaincore.entities.EntityUpdater.update(EntityUpdater.java:32)
at technology.rocketjump.mountaincore.gamecontext.GameUpdateRegister.update(GameUpdateRegister.java:32)