fix bug where card view window with single card is too short (#5211)

It was a divide by 0 bug lol
This commit is contained in:
RickyRister 2024-11-30 05:53:30 -08:00 committed by GitHub
parent bb84b75db9
commit 70559d32df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -198,7 +198,7 @@ ZoneViewZone::GridSize ZoneViewZone::positionCardsForDisplay(CardList &cards, Ca
return GridSize{longestRow + 1, qMax(col + 1, 3)};
} else {
int cols = qMin(qFloor(qSqrt((double)cardCount / 2)), 7);
int cols = qBound(1, qFloor(qSqrt((double)cardCount / 2)), 7);
int rows = qMax(qCeil((double)cardCount / cols), 1);
if (minRows == 0) {
minRows = rows;