From f349aafc37fca2fad6eb40d9e739cd9c1ba99a96 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Tue, 9 Aug 2022 09:38:43 +0200 Subject: [PATCH] fix: Crash when auto-load-patterns is being disabled --- .../builtin/source/content/views/view_pattern_editor.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/builtin/source/content/views/view_pattern_editor.cpp b/plugins/builtin/source/content/views/view_pattern_editor.cpp index 5e76c63e8..51745ce6d 100644 --- a/plugins/builtin/source/content/views/view_pattern_editor.cpp +++ b/plugins/builtin/source/content/views/view_pattern_editor.cpp @@ -109,13 +109,12 @@ namespace hex::plugin::builtin { }); EventManager::subscribe(this, [this](prv::Provider *provider) { + auto &patternLanguageData = ProviderExtraData::get(provider).patternLanguage; + patternLanguageData.runtime = ContentRegistry::PatternLanguage::createDefaultRuntime(provider); + if (!this->m_autoLoadPatterns) return; - auto &patternLanguageData = ProviderExtraData::get(provider).patternLanguage; - - patternLanguageData.runtime = ContentRegistry::PatternLanguage::createDefaultRuntime(provider); - // Copy over current pattern source code to the new provider if (!this->m_syncPatternSourceCode) { patternLanguageData.sourceCode = this->m_textEditor.GetText();