remove Part via mouse (FIX: ConcurrentModificationException)
This commit is contained in:
parent
2f7b2568c6
commit
e71791d0b2
@ -80,7 +80,7 @@ public class Circuit {
|
||||
|
||||
public void removePart(final Part part) {
|
||||
if (parts.remove(part)) {
|
||||
part.getJunctions().forEach(junction -> junction.getWires().forEach(this::disconnect));
|
||||
part.getJunctions().stream().flatMap(junction -> junction.getWires().stream()).toList().forEach(this::disconnect); // jep, first toList(), then forEach (due to concurrent modification)
|
||||
} else {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user