diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm index c1d46954d1..9abe6f1182 100644 --- a/C4/HoldsQueue.pm +++ b/C4/HoldsQueue.pm @@ -484,7 +484,7 @@ sub _allocateWithTransportCostMatrix { RETRY: while (1) { - return [] if $num_agents == 0 || $num_tasks == 0; + return [] if $num_agents == 0 || $num_tasks + scalar(@remaining) == 0; if ( $num_tasks < $num_agents && @remaining ) {