mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-12 11:21:16 +01:00
Fixed ConfigNode#remove ConcurrentModificationException
This commit is contained in:
parent
c4a0e18dd9
commit
2b4281ee53
@ -126,11 +126,12 @@ public class ConfigNode {
|
||||
parent.nodeOrder.remove(key);
|
||||
updateParent(null);
|
||||
|
||||
for (String key : nodeOrder) {
|
||||
ConfigNode child = childNodes.get(key);
|
||||
if (child != null) child.remove();
|
||||
}
|
||||
|
||||
// Remove children recursively to avoid memory leaks
|
||||
nodeOrder.stream()
|
||||
.sorted() // will use internal state and prevent Concurrent modification of underlying list
|
||||
.map(childNodes::get)
|
||||
.filter(Objects::nonNull)
|
||||
.forEach(ConfigNode::remove);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user