From 74c06bd13e8e2bb11a26ec224b5fb5f3d1193b5c Mon Sep 17 00:00:00 2001 From: Hamish Milne Date: Thu, 2 Apr 2020 01:43:27 +0100 Subject: [PATCH] Attempt to fix crashes with LLE applets --- src/core/memory.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 184b7f9bd8..c6a213ff06 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -284,8 +284,10 @@ void MemorySystem::RegisterPageTable(std::shared_ptr page_table) { } void MemorySystem::UnregisterPageTable(std::shared_ptr page_table) { - impl->page_table_list.erase( - std::find(impl->page_table_list.begin(), impl->page_table_list.end(), page_table)); + auto it = std::find(impl->page_table_list.begin(), impl->page_table_list.end(), page_table); + if (it != impl->page_table_list.end()) { + impl->page_table_list.erase(it); + } } /**