diff --git a/main/source/window/window.cpp b/main/source/window/window.cpp index 56535334c..7c5a329ae 100644 --- a/main/source/window/window.cpp +++ b/main/source/window/window.cpp @@ -114,14 +114,15 @@ namespace hex { if (ImHexApi::Provider::isValid()) { auto provider = ImHexApi::Provider::get(); - if (!windowTitle.empty()) + if (!windowTitle.empty() && provider != nullptr) { title += " - " + windowTitle; - if (provider->isDirty()) - title += " (*)"; + if (provider->isDirty()) + title += " (*)"; - if (!provider->isWritable()) - title += " (Read Only)"; + if (!provider->isWritable()) + title += " (Read Only)"; + } } this->m_windowTitle = title; diff --git a/plugins/builtin/source/content/events.cpp b/plugins/builtin/source/content/events.cpp index 77d6de100..fb54efc00 100644 --- a/plugins/builtin/source/content/events.cpp +++ b/plugins/builtin/source/content/events.cpp @@ -44,13 +44,18 @@ namespace hex::plugin::builtin { EventManager::subscribe([](hex::prv::Provider *oldProvider, hex::prv::Provider *newProvider) { hex::unused(oldProvider); - if (newProvider != nullptr) { + if (newProvider != nullptr && newProvider->isAvailable()) { EventManager::post(newProvider->getName()); } else { EventManager::post(""); } }); + EventManager::subscribe([](hex::prv::Provider *provider) { + if (provider != nullptr && ImHexApi::Provider::get() == provider) + EventManager::post(provider->getName()); + }); + EventManager::subscribe(openFile); EventManager::subscribe([](const std::string &name) {