Skip to content

Commit

Permalink
Reduce chances of CME when iterating class info cache
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedt committed Mar 29, 2024
1 parent ddffe93 commit 226e4a3
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ private static void doClear() {
MixinEnvironment.getDefaultEnvironment().audit();
try {
ClassNode emptyNode = new ClassNode();
classInfoCache.entrySet().removeIf(entry -> {
List<Map.Entry<String, ClassInfo>> entries = new ArrayList<>(classInfoCache.entrySet());
entries.stream().filter(entry -> {
if(entry.getKey().equals("java/lang/Object"))
return false;
ClassInfo mixinClz = entry.getValue();
Expand All @@ -88,7 +89,7 @@ private static void doClear() {
e.printStackTrace();
}
return true;
});
}).forEach(entry -> classInfoCache.remove(entry.getKey()));
} catch (RuntimeException e) {
e.printStackTrace();
}
Expand Down

0 comments on commit 226e4a3

Please sign in to comment.