From 1fc9ab8499dad1374749a4b12947c912322e05cc Mon Sep 17 00:00:00 2001 From: Awen <39176130+yu1183688986@users.noreply.github.com> Date: Fri, 30 Apr 2021 10:42:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=9B=86=E5=90=88=E9=81=8D?= =?UTF-8?q?=E5=8E=86=E5=88=A0=E9=99=A4=E5=85=83=E7=B4=A0=E7=9A=84java.util?= =?UTF-8?q?.ConcurrentModificationException=20=E5=BC=82=E5=B8=B8=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/media/zlm/ZLMHttpHookSubscribe.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java index bf54f50a..a69cec87 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java @@ -63,7 +63,7 @@ public class ZLMHttpHookSubscribe { } } - if (result) { + if (null != result && result) { event = eventMap.get(key); } } @@ -75,7 +75,10 @@ public class ZLMHttpHookSubscribe { if (eventMap == null) { return; } - for (JSONObject key : eventMap.keySet()) { + Iterator> iterator = eventMap.entrySet().iterator(); + while (iterator.hasNext()){ + Map.Entry next = iterator.next(); + JSONObject key = next.getKey(); Boolean result = null; for (String s : key.keySet()) { if (result == null) { @@ -85,8 +88,8 @@ public class ZLMHttpHookSubscribe { } } - if (result) { - eventMap.remove(key); + if (null != result && result){ + iterator.remove(); } } }