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

Fix: Cosmetic HUD placement reset position corrupting ship json #2961

Merged
merged 1 commit into from
Jun 12, 2023

Conversation

Archez
Copy link
Contributor

@Archez Archez commented Jun 6, 2023

The ship.json was getting corrupted upon saving after pressing the "Reset all positions" button in the hud placements section for the Cosmetic Editor.

The problem was the variable type we were assigning to was const char* and in the assignment we were doing a call to std::string(const char* str) this resulted in a Implicit Constructor call not supported leading to undefined behavior when building the final CVar name.

The solution is to capture the assignment as a std:string and performing the final .c_str() when calling the CVar method. This is how it was being done for all the other buttons here.

Build Artifacts

Copy link
Contributor

@briaguya-ai briaguya-ai left a comment

Choose a reason for hiding this comment

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

seems like the same pattern I used to fix another crash in #2828

:shipit:

@leggettc18 leggettc18 merged commit 90bd072 into HarbourMasters:develop Jun 12, 2023
@Archez Archez deleted the fix-reset-hud-positions branch June 12, 2023 23:18
@garrettjoecox garrettjoecox added this to the Sulu (7.1.x) milestone Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants