From 68bd5569ce3444e326924a45f1a35876c1271b85 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 11 Jan 2021 09:50:51 +0100 Subject: [PATCH] Don't show Plugin Views menu if there are no views --- source/window.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/window.cpp b/source/window.cpp index 1f2f38f59..cbdfdda51 100644 --- a/source/window.cpp +++ b/source/window.cpp @@ -161,13 +161,15 @@ namespace hex { ImGui::MenuItem((view->getName() + " View").c_str(), "", &view->getWindowOpenState()); } - if (ImGui::BeginMenu("Plugin Views")) { - for (auto &view : this->m_pluginViews) { - if (view->hasViewMenuItemEntry()) - ImGui::MenuItem((view->getName() + " View").c_str(), "", &view->getWindowOpenState()); - } + if (!this->m_pluginViews.empty()) { + if (ImGui::BeginMenu("Plugin Views")) { + for (auto &view : this->m_pluginViews) { + if (view->hasViewMenuItemEntry()) + ImGui::MenuItem((view->getName() + " View").c_str(), "", &view->getWindowOpenState()); + } - ImGui::EndMenu(); + ImGui::EndMenu(); + } } ImGui::EndMenu();