Skip to content

Commit

Permalink
Fix crash when GUI dimensions are too small
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed May 17, 2021
1 parent aa7eb8d commit 7371edb
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ public boolean updateBounds(Rectangle2d availableArea, Set<Rectangle2d> guiExclu
.collect(Collectors.toList());

final int maxWidth = this.ingredientGrid.maxWidth();
Size2i maxContentSize = new Size2i(maxWidth, availableArea.getHeight());
final int maxHeight = availableArea.getHeight();
if (maxWidth <= 0 || maxHeight <= 0) {
return false;
}
Size2i maxContentSize = new Size2i(maxWidth, maxHeight);
availableArea = MathUtil.cropToAvoidIntersection(intersectsNavigationArea, availableArea, maxContentSize);
if (MathUtil.contentArea(availableArea, maxContentSize) == 0) {
return false;
Expand Down

0 comments on commit 7371edb

Please sign in to comment.