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:
parent
14f9a29502
commit
97508844dc
1 changed files with 27 additions and 24 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue