diff --git a/common/src/main/java/com/dtteam/dynamictrees/tree/family/Family.java b/common/src/main/java/com/dtteam/dynamictrees/tree/family/Family.java index a478eb678..3028d727e 100644 --- a/common/src/main/java/com/dtteam/dynamictrees/tree/family/Family.java +++ b/common/src/main/java/com/dtteam/dynamictrees/tree/family/Family.java @@ -311,9 +311,11 @@ public boolean isWood() { } protected Optional getBranchBlock(int index) { + if (index < 0 || index >= branches.size()) return Optional.empty(); // Some families (e.g. from add-on tree packs) have no stripped branch entry. return Optionals.ofBlock(branches.get(index).getBlock()); } protected Optional getBranchItem(int index) { + if (index < 0 || index >= branches.size()) return Optional.empty(); return branches.get(index).getItem(); }