Skip to content

Commit

Permalink
Merge pull request #4101 from Kkrafy/develop
Browse files Browse the repository at this point in the history
Fix for error when executing a token macro as a player with the current map not visible
  • Loading branch information
cwisniew authored Jun 7, 2023
2 parents ee8a79f + faed8e8 commit 81293b8
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import java.awt.Point;
import java.awt.geom.Area;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -341,12 +343,16 @@ private void handle(SetZoneVisibilityMsg msg) {

var zone = MapTool.getCampaign().getZone(zoneGUID);
zone.setVisible(visible);

ZoneRenderer currentRenderer = MapTool.getFrame().getCurrentZoneRenderer();
if (!visible
&& !MapTool.getPlayer().isGM()
&& currentRenderer != null
&& currentRenderer.getZone().getId().equals(zoneGUID)) {
Collection<GUID> AllTokenIDs = new ArrayList<>();
for (Token token : currentRenderer.getZone().getAllTokens()) {
AllTokenIDs.add(token.getId());
}
currentRenderer.getSelectionModel().removeTokensFromSelection(AllTokenIDs);
MapTool.getFrame().setCurrentZoneRenderer(null);
}
if (visible && currentRenderer == null) {
Expand Down

0 comments on commit 81293b8

Please sign in to comment.