diff --git a/lib/external/imgui/source/TextEditor.cpp b/lib/external/imgui/source/TextEditor.cpp index 02595a9c8..078e35a4a 100644 --- a/lib/external/imgui/source/TextEditor.cpp +++ b/lib/external/imgui/source/TextEditor.cpp @@ -2041,7 +2041,9 @@ void TextEditor::ColorizeInternal() { } } } - line[currentIndex].mPreprocessor = withinPreproc; + if (currentIndex < line.size()) + line[currentIndex].mPreprocessor = withinPreproc; + currentIndex += UTF8CharLength(c); if (currentIndex >= (int)line.size()) { currentIndex = 0; diff --git a/lib/libimhex/source/api/imhex_api.cpp b/lib/libimhex/source/api/imhex_api.cpp index d7415676a..64faca59a 100644 --- a/lib/libimhex/source/api/imhex_api.cpp +++ b/lib/libimhex/source/api/imhex_api.cpp @@ -312,13 +312,13 @@ namespace hex { EventManager::post(provider); - s_providers.erase(it); if (s_providers.empty()) EventManager::post(provider, nullptr); else if (it - s_providers.begin() == s_currentProvider) setCurrentProvider(0); + s_providers.erase(it); provider->close(); EventManager::post(provider);