fix: Invalid toolbar items appearing in the toolbar

This commit is contained in:
WerWolv
2025-12-25 20:12:31 +01:00
parent d42665db88
commit bf461abfec

View File

@@ -482,6 +482,17 @@ namespace hex::plugin::builtin {
ContentRegistry::UserInterface::addToolbarItem([] {
for (const auto &menuItem : ContentRegistry::UserInterface::impl::getToolbarMenuItems()) {
// Remove invalid toolbar items from the toolbar
if (menuItem == nullptr)
continue;
if (menuItem->unlocalizedNames.empty() || menuItem->icon.glyph.empty()) {
menuItem->toolbarIndex = -1;
continue;
}
ImGui::PushID(menuItem);
ON_SCOPE_EXIT { ImGui::PopID(); };
const auto &unlocalizedItemName = menuItem->unlocalizedNames.back();
if (unlocalizedItemName.get() == ContentRegistry::UserInterface::impl::SeparatorValue) {
ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);