fix: Make sure PerProvider don't get accessed using a nullptr provider

This commit is contained in:
WerWolv
2025-05-17 20:29:54 +02:00
parent 57c2d84122
commit 2ef2cdd874
4 changed files with 20 additions and 3 deletions

View File

@@ -1090,8 +1090,12 @@ namespace hex::plugin::builtin {
});
EventHighlightingChanged::subscribe(this, [this]{
m_foregroundHighlights->clear();
m_backgroundHighlights->clear();
auto provider = ImHexApi::Provider::get();
if (provider == nullptr)
return;
m_foregroundHighlights.get(provider).clear();
m_backgroundHighlights.get(provider).clear();
});
ProjectFile::registerPerProviderHandler({

View File

@@ -168,7 +168,6 @@ namespace hex::plugin::builtin {
});
// Initialize the selected rule iterators to point to the end of the rules lists
m_selectedRule = m_rules->end();
EventProviderOpened::subscribe([this](prv::Provider *provider) {
m_selectedRule.get(provider) = m_rules.get(provider).end();
});

View File

@@ -1462,6 +1462,8 @@ namespace hex::plugin::builtin {
void ViewPatternEditor::drawAlwaysVisibleContent() {
auto provider = ImHexApi::Provider::get();
if (provider == nullptr)
return;
auto open = m_sectionWindowDrawer.contains(provider);
if (open) {