1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 03:08:11 +00:00

WindowServer: Use early return to reduce nesting

This commit is contained in:
Shannon Booth 2020-02-11 20:33:38 +13:00 committed by Andreas Kling
parent 14f9a29502
commit 97508844dc

View file

@ -125,8 +125,11 @@ void Menu::redraw()
Window& Menu::ensure_menu_window()
{
if (m_menu_window)
return *m_menu_window;
int width = this->content_width();
if (!m_menu_window) {
Gfx::Point next_item_location(frame_thickness(), frame_thickness());
for (auto& item : m_items) {
int height = 0;
@ -151,7 +154,7 @@ Window& Menu::ensure_menu_window()
window->set_rect(0, 0, width, window_height);
m_menu_window = move(window);
draw();
}
return *m_menu_window;
}