From 3929c3c4634e52e5de77faf9a8171e725cc37016 Mon Sep 17 00:00:00 2001
From: Alex Shvartzkop <dudesuchamazing@gmail.com>
Date: Tue, 11 Feb 2025 00:08:39 +0300
Subject: [PATCH] Fix trying to erase m_files end when removing an embedded
 file.

---
 common/embedded_files.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/embedded_files.cpp b/common/embedded_files.cpp
index 2ece333880..2ac141c607 100644
--- a/common/embedded_files.cpp
+++ b/common/embedded_files.cpp
@@ -127,10 +127,10 @@ void EMBEDDED_FILES::RemoveFile( const wxString& name, bool aErase )
 
     if( it != m_files.end() )
     {
-        m_files.erase( it );
-
         if( aErase )
             delete it->second;
+
+        m_files.erase( it );
     }
 }