Merge pull request #485 from CocoTheOwner/fixTreeNPE

Fix tree NPE
This commit is contained in:
Dan 2021-07-30 04:49:10 -04:00 committed by GitHub
commit beff1d8d42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,6 +83,18 @@ public class TreeManager implements Listener {
return; return;
} }
if (worldAccess.getCompound() == null) {
Iris.debug(this.getClass().getName() + " passed off to vanilla because dimension compound is null");
Iris.reportError(new NullPointerException(event.getWorld().getName() + " is accessible but does not have compound"));
return;
}
if (worldAccess.getCompound().getRootDimension() == null) {
Iris.debug(this.getClass().getName() + " passed off to vanilla because compound's root dimension is null");
Iris.reportError(new NullPointerException(event.getWorld().getName() + " is accessible & has compound but has no root dimension"));
return;
}
if (!worldAccess.getCompound().getRootDimension().getTreeSettings().isEnabled()) { if (!worldAccess.getCompound().getRootDimension().getTreeSettings().isEnabled()) {
Iris.debug(this.getClass().getName() + " cancelled because tree overrides are disabled"); Iris.debug(this.getClass().getName() + " cancelled because tree overrides are disabled");
return; return;