fix: Crash when auto-load-patterns is being disabled

This commit is contained in:
WerWolv 2022-08-09 09:38:43 +02:00
parent 8ebbe6fb4e
commit f349aafc37
1 changed files with 3 additions and 4 deletions

View File

@ -109,13 +109,12 @@ namespace hex::plugin::builtin {
});
EventManager::subscribe<EventProviderOpened>(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();