Skip to content

Commit fb50aa8

Browse files
committed
Fix NPE when spending XP on new skills (Fixes #8707)
Root Cause When spending XP to acquire a new skill, getSkill() returns null before the skill exists. After improveSkill() creates the skill, the local skill variable was never updated, causing a NullPointerException when accessing skill.getType() and skill.getLevel(). Changes 1. PersonnelTableMouseAdapter.java - Re-fetch the skill after improveSkill() creates it Files Changed - MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java - Added skill re-fetch after creation
1 parent 042d993 commit fb50aa8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ public void actionPerformed(ActionEvent action) {
666666
int cost = MathUtility.parseInt(data[2]);
667667
selectedPerson.improveSkill(skillName);
668668
selectedPerson.spendXPOnSkills(getCampaign(), cost);
669+
skill = selectedPerson.getSkill(skillName);
669670
SkillType skillType = skill.getType();
670671

671672
PerformanceLogger.improvedSkill(getCampaignOptions().isPersonnelLogSkillGain(),

0 commit comments

Comments
 (0)