fixed crash when all windows were hidden

master
Christian Burger 2022-05-06 22:15:34 +02:00
parent 320f5ba63a
commit b723aa5f33
1 changed files with 7 additions and 1 deletions

View File

@ -66,10 +66,16 @@ namespace krikkel::NCurses
void VerticalTilingWindowManager::updateLayout()
{
size_t stackSize = visibleStack.size();
if(stackSize == 0)
{
rootWindow->clear();
return;
}
scoped_lock lock(*ncursesMutex);
int availableWidth = rootWindow->width();
int availableHeight = rootWindow->height();
size_t stackSize = visibleStack.size();
int windowHeight = availableHeight / stackSize - 1;
if((windowHeight + 1) * stackSize < availableHeight)