LibGUI: Don't crash when rendering a collapsible toolbar with no items

This prevents a crash in GML Playground that would occur when
previewing a GUI with a collapsible toolbar.
This commit is contained in:
Tim Ledbetter 2024-05-15 06:03:16 +01:00 committed by Andreas Kling
parent 6876c62110
commit 6290f96aa7

View file

@ -165,7 +165,7 @@ ErrorOr<void> Toolbar::create_overflow_objects()
ErrorOr<void> Toolbar::update_overflow_menu()
{
if (!m_collapsible)
if (!m_collapsible || m_items.is_empty())
return {};
Optional<size_t> marginal_index {};