8000 Fix: (Sentry) Fixed Exception When Processing Education Tagalongs if Tagalong Has Exited the Campaign by IllianiBird · Pull Request #7029 · MegaMek/mekhq · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix: (Sentry) Fixed Exception When Processing Education Tagalongs if Tagalong Has Exited the Campaign #7029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2025

Conversation

IllianiBird
Copy link
Collaborator

Fix Sentry Report

If the player deleted one of a character's education tagalongs they'd be hit with an exception when we attempted to update the status of a tagalong when setting the character to a non-Student status.

@IllianiBird IllianiBird self-assigned this May 16, 2025
@IllianiBird IllianiBird requested a review from a team as a code owner May 16, 2025 18:28
@IllianiBird IllianiBird added Bug Personnel Personnel-related Issues Severity: Medium Issues described as medium severity as per the new issue form labels May 16, 2025
Copy link
codecov bot commented May 16, 2025

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 12.04%. Comparing base (13a135e) to head (26513e4).
Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
MekHQ/src/mekhq/campaign/personnel/Person.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7029      +/-   ##
============================================
- Coverage     12.04%   12.04%   -0.01%     
  Complexity     6891     6891              
============================================
  Files          1102     1102              
  Lines        142196   142201       +5     
  Branches      21984    21986       +2     
============================================
- Hits          17131    17125       -6     
- Misses       123230   123246      +16     
+ Partials       1835     1830       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@HammerGS HammerGS requested a review from Copilot May 17, 2025 01:00
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Prevent null-pointer exception when updating education tagalongs if a tagalong has been removed.

  • Added a null-check before invoking changeStatus on each tagAlong
  • Retained logic to clear the eduTagAlongs list after processing
Comments suppressed due to low confidence (2)

MekHQ/src/mekhq/campaign/personnel/Person.java:1349

  • Use the passed-in today parameter instead of campaign.getLocalDate() when updating tagAlong status to maintain consistency with the current status-change date.
tagAlong.changeStatus(campaign, campaign.getLocalDate(), PersonnelStatus.ACTIVE);

MekHQ/src/mekhq/campaign/personnel/Person.java:1345

  • Add a unit test covering the scenario where eduTagAlongs contains IDs not present in the campaign, verifying no exception occurs and the list is cleared correctly.
for (UUID tagAlongId : eduTagAlongs) {

@Scoppio Scoppio merged commit f001305 into MegaMek:master May 17, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Personnel Personnel-related Issues Severity: Medium Issues described as medium severity as per the new issue form
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0