From ebb2fe458bcd2b8d29d2b5c86815db8eb4f2b908 Mon Sep 17 00:00:00 2001 From: Adrian Nistor Date: Tue, 25 Jun 2019 21:02:45 +0000 Subject: [PATCH] HashMap is not thread safe. The existing synchronzed(map) is too small, should be extended to cover the surrounding code. --- .../src/main/java/mage/client/util/gui/ArrowBuilder.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/util/gui/ArrowBuilder.java b/Mage.Client/src/main/java/mage/client/util/gui/ArrowBuilder.java index 3520af3b4c..b471998a53 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/ArrowBuilder.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/ArrowBuilder.java @@ -112,10 +112,11 @@ public class ArrowBuilder { * Removes all arrows from the screen. */ public void removeAllArrows(UUID gameId) { - if (map.containsKey(gameId)) { - Map> innerMap = map.get(gameId); - JPanel p = getArrowsPanel(gameId); - synchronized (map) { + synchronized (map) { + if (map.containsKey(gameId)) { + Map> innerMap = map.get(gameId); + JPanel p = getArrowsPanel(gameId); + if (p != null && p.getComponentCount() > 0) { p.removeAll(); p.revalidate();