natinusala / borealis

Hardware accelerated, controller and TV oriented UI library for PC and Nintendo Switch (libnx)
Apache License 2.0
260 stars 83 forks source link

Segfault when Sidebar has no child #29

Closed jon-dez closed 4 years ago

jon-dez commented 4 years ago

There is a segfault when borealis tries to render a sidebar with no children. Unsure if this is intended, but a quick fix is trivial.

// File: library/lib/sidebar.cpp

View* Sidebar::getDefaultFocus()
{

    ...

// Line 43
    View* toFocus{ nullptr };
    if(this->children.size() != 0)
        // Try to focus last focused one
        toFocus = this->children[this->lastFocus]->view->getDefaultFocus();

    ...

}