Fix the trick options loop (#4917)

It initialized an array with a size, which pre-filled
it all with nullptrs, and then used push_back on top of that.
So it was a bunch of nullptrs followed by the actual
option pointers. Fixed by calling reserve instead of
constructing with a size, so it reserves the memory it needs
without actually filling the vector with nullptrs, so push_back
properly starts from the beginning.
This commit is contained in:
Christopher Leggett 2025-01-19 20:06:42 -05:00 committed by GitHub
parent ed674f1ed2
commit 526aad59d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -533,7 +533,8 @@ void Settings::CreateOptions() {
});
// TODO: Exclude Locations Menus
mTricksByArea.clear();
std::vector<Option*> tricksOption(mTrickOptions.size());
std::vector<Option*> tricksOption;
tricksOption.reserve(mTrickOptions.size());
for (int i = 0; i < RT_MAX; i++) {
auto trick = &mTrickOptions[i];
if (!trick->GetName().empty()) {