Skip to content

Commit

Permalink
Fix iterator leak. Fix #168
Browse files Browse the repository at this point in the history
  • Loading branch information
tr7zw committed Aug 28, 2024
1 parent 4ee31d5 commit 1c96819
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/dev/tr7zw/entityculling/CullTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ private void cullEntities(Vec3 cameraMC, Vec3d camera) {
// less
// overhead probably than trying to sync stuff up for no really good reason
}
if (entity == null || !(entity instanceof Cullable)) {
if (entity == null) {
// assume the iterator is broken, cancel the loop https://github.com/tr7zw/EntityCulling/issues/168
break;
}
if (!(entity instanceof Cullable)) {
continue; // Not sure how this could happen outside from mixin screwing up the inject into
// Entity
}
Expand Down Expand Up @@ -145,6 +149,10 @@ private void cullBlockEntities(Vec3 cameraMC, Vec3d camera) {
// less
// overhead probably than trying to sync stuff up for no really good reason
}
if (entry == null) {
// assume the iterator is broken, cancel the loop https://github.com/tr7zw/EntityCulling/issues/168
break;
}
if (blockEntityWhitelist.contains(entry.getValue().getType())) {
continue;
}
Expand Down

0 comments on commit 1c96819

Please sign in to comment.