From 7a3e1f1494d83e7327d50cff65b768db7730ba09 Mon Sep 17 00:00:00 2001 From: RickyRister Date: Sat, 30 Nov 2024 00:07:53 -0800 Subject: [PATCH] fix bug where card view window with single card is too short It was a divide by 0 bug lol --- cockatrice/src/game/zones/view_zone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cockatrice/src/game/zones/view_zone.cpp b/cockatrice/src/game/zones/view_zone.cpp index 566b4896e..34e43b4b8 100644 --- a/cockatrice/src/game/zones/view_zone.cpp +++ b/cockatrice/src/game/zones/view_zone.cpp @@ -196,7 +196,7 @@ ZoneViewZone::GridSize ZoneViewZone::positionCardsForDisplay(CardList &cards, Ca return GridSize{longestRow, 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;