diff --git a/src/musikbox/cursespp/ListOverlay.cpp b/src/musikbox/cursespp/ListOverlay.cpp index b1e3707e3..65617983d 100644 --- a/src/musikbox/cursespp/ListOverlay.cpp +++ b/src/musikbox/cursespp/ListOverlay.cpp @@ -143,10 +143,14 @@ void ListOverlay::RecalculateSize() { if (this->adapter) { this->height = std::min( - (int) MAX_HEIGHT, + (int) MAX_HEIGHT, (int) (4 + this->adapter->GetEntryCount())); } + /* constrain to app bounds */ + this->height = std::max(0, std::min(Screen::GetHeight() - 4, this->height)); + this->width = std::max(0, std::min(Screen::GetWidth(), this->width)); + this->y = VERTICAL_PADDING; this->x = (Screen::GetWidth() / 2) - (this->width / 2); }