Skip to content

Commit bf461ab

Browse files
committed
fix: Invalid toolbar items appearing in the toolbar
1 parent d42665d commit bf461ab

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

plugins/builtin/source/content/ui_items.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,17 @@ namespace hex::plugin::builtin {
482482
ContentRegistry::UserInterface::addToolbarItem([] {
483483

484484
for (const auto &menuItem : ContentRegistry::UserInterface::impl::getToolbarMenuItems()) {
485+
// Remove invalid toolbar items from the toolbar
486+
if (menuItem == nullptr)
487+
continue;
488+
if (menuItem->unlocalizedNames.empty() || menuItem->icon.glyph.empty()) {
489+
menuItem->toolbarIndex = -1;
490+
continue;
491+
}
492+
493+
ImGui::PushID(menuItem);
494+
ON_SCOPE_EXIT { ImGui::PopID(); };
495+
485496
const auto &unlocalizedItemName = menuItem->unlocalizedNames.back();
486497
if (unlocalizedItemName.get() == ContentRegistry::UserInterface::impl::SeparatorValue) {
487498
ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);

0 commit comments

Comments
 (0)