From e7b0653ebce560dcdc0df2773ded83ad5c396a2f Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Sat, 9 May 2020 15:37:19 +0200 Subject: [PATCH] Fixed crash when item pipe in round robin mode no longer has any destination. Fixes #6 --- CHANGELOG.md | 3 ++- .../pipe/attachment/extractor/ItemDestinationFinder.java | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39132f4..89ccbff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ ## 0.4.1 - Added formatting to quantities in the tooltips (raoulvdberge) - Fixed invalid cast server crash (raoulvdberge) -- Fixed server log spamming when destination for items are not found (raoulvdberge) +- Fixed log spamming when destination for items are not found (raoulvdberge) +- Fixed crash when item pipe in round robin mode no longer has any destination (raoulvdberge) ## 0.4 - Added filtering options for the Extractor Attachment (raoulvdberge) diff --git a/src/main/java/com/raoulvdberge/refinedpipes/network/pipe/attachment/extractor/ItemDestinationFinder.java b/src/main/java/com/raoulvdberge/refinedpipes/network/pipe/attachment/extractor/ItemDestinationFinder.java index a85de08..27919a0 100644 --- a/src/main/java/com/raoulvdberge/refinedpipes/network/pipe/attachment/extractor/ItemDestinationFinder.java +++ b/src/main/java/com/raoulvdberge/refinedpipes/network/pipe/attachment/extractor/ItemDestinationFinder.java @@ -50,6 +50,10 @@ public Destination find(RoutingMode routingMode, BlockPos sourcePos, ItemStack e } case ROUND_ROBIN: { List destinations = network.getDestinations(DestinationType.ITEM_HANDLER); + if (destinations.isEmpty()) { + return null; + } + if (roundRobinIndex >= destinations.size()) { roundRobinIndex = 0; }