From 799a9a5f98c4eb084a7e1014c3f54d1505adcba2 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 18 Oct 2021 11:00:55 -0700 Subject: [PATCH] lr: fix EraseRedirection hang introduced by refactoring --- .../source/lr/lr_location_redirector.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libraries/libstratosphere/source/lr/lr_location_redirector.cpp b/libraries/libstratosphere/source/lr/lr_location_redirector.cpp index 4a7859126..17158d18a 100644 --- a/libraries/libstratosphere/source/lr/lr_location_redirector.cpp +++ b/libraries/libstratosphere/source/lr/lr_location_redirector.cpp @@ -86,25 +86,27 @@ namespace ams::lr { void LocationRedirector::EraseRedirection(ncm::ProgramId program_id) { /* Remove any redirections with a matching program id. */ - for (auto it = m_redirection_list.begin(); it != m_redirection_list.end();) { + for (auto it = m_redirection_list.begin(); it != m_redirection_list.end(); /* ... */) { if (it->GetProgramId() == program_id) { auto *redirection = std::addressof(*it); - m_redirection_list.erase(it); + it = m_redirection_list.erase(it); delete redirection; break; + } else { + ++it; } } } void LocationRedirector::ClearRedirections(u32 flags) { /* Remove any redirections with matching flags. */ - for (auto it = m_redirection_list.begin(); it != m_redirection_list.end();) { + for (auto it = m_redirection_list.begin(); it != m_redirection_list.end(); /* ... */) { if ((it->GetFlags() & flags) == flags) { auto *redirection = std::addressof(*it); it = m_redirection_list.erase(it); delete redirection; } else { - it++; + ++it; } } }