Skip to content
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

EntityImage: Handle unknown elevation exceptions #5216

Merged
merged 2 commits into from
Mar 13, 2024

Conversation

SJuliez
Copy link
Member

@SJuliez SJuliez commented Mar 4, 2024

Entity.getElevation throws an exception when the unit has no elevation (e.g. offboard).
Fixes #5214

Copy link
Collaborator

@Sleet01 Sleet01 left a comment

Choose a reason for hiding this comment

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

lgtm!

unitElevation = entity.getElevation();
int elevation = 0;
try {
elevation = entity.getElevation();
Copy link
Member

Choose a reason for hiding this comment

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

Do we really want to use exceptions for flow control here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Doesn't look like the place for an exception. This was old code in Entity. I removed the exception. One could add a hasElevation or knowsElevation method or something but that's a bit beyond this PR.

@HammerGS
Copy link
Member

Merging as review requests completed.

@HammerGS HammerGS merged commit 4a62599 into MegaMek:master Mar 13, 2024
4 checks passed
@SJuliez SJuliez deleted the icon-shadow-error branch April 2, 2024 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0.49.19 Nightly from 2/27/2024 - Uncaught Exception when loading saved game causing soft lock
5 participants