From 8e9528b365be760f7ffd82c53e6992f2a21b3cd6 Mon Sep 17 00:00:00 2001 From: Brian Reynolds Date: Tue, 12 Sep 2023 15:51:29 -0400 Subject: [PATCH] Don't divide by zero --- .../build/module/map/boardPicker/board/mapgrid/Zone.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vassal-app/src/main/java/VASSAL/build/module/map/boardPicker/board/mapgrid/Zone.java b/vassal-app/src/main/java/VASSAL/build/module/map/boardPicker/board/mapgrid/Zone.java index fb706c4ca1..5eddc882c9 100644 --- a/vassal-app/src/main/java/VASSAL/build/module/map/boardPicker/board/mapgrid/Zone.java +++ b/vassal-app/src/main/java/VASSAL/build/module/map/boardPicker/board/mapgrid/Zone.java @@ -361,6 +361,10 @@ else if (token.equals(GRID_LOCATION) && getGrid() != null) { // no grid to match against // try the geographic mean p = new Point(0, 0); + if (myPolygon.npoints <= 0) { + return p; + } + for (int i = 0; i < myPolygon.npoints; ++i) { p.translate(myPolygon.xpoints[i], myPolygon.ypoints[i]); }