From 1bbde39439b3cd11bf7b3ea8bab77c25af744c56 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Sun, 4 Sep 2022 02:03:16 -0500 Subject: [PATCH] Ensure itemTrackerNotes vector is not fully empty --- .../Enhancements/randomizer/randomizer_item_tracker.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index 5b52047ab..cf9ccfdbd 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -511,9 +511,6 @@ void DrawNotes(bool resizeable = false) { (void*)itemTrackerNotes); } }; - if (itemTrackerNotes.empty()) { - itemTrackerNotes.push_back(0); - } ImVec2 size = resizeable ? ImVec2(-FLT_MIN, ImGui::GetContentRegionAvail().y) : ImVec2(((iconSize + iconSpacing) * 6) - 8, 200); ItemTrackerNotes::TrackerNotesInputTextMultiline("##ItemTrackerNotes", &itemTrackerNotes, size, ImGuiInputTextFlags_AllowTabInput); if (ImGui::IsItemDeactivatedAfterEdit() && IsValidSaveFile()) { @@ -926,6 +923,10 @@ void InitItemTracker() { trackerBgB, trackerBgA }; // Float value, 1 = 255 in rgb value. + // Crashes when the itemTrackerNotes is empty, so add an empty character to it + if (itemTrackerNotes.empty()) { + itemTrackerNotes.push_back(0); + } Ship::RegisterHook([](OSContPad* cont_pad) { buttonsPressed = cont_pad; });