From: Dan Wells Date: Tue, 21 Jun 2011 15:44:10 +0000 (-0400) Subject: MFHD compressed holdings short-circuit logic X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0b0eac3f88fa4c26a2997f8a26ae795b38e32525;p=Evergreen.git MFHD compressed holdings short-circuit logic If you attempt to get compressed (or uncompressed) holdings from a MFHD record with only a caption, the code should short-circuit and return an empty list. Signed-off-by: Dan Wells Signed-off-by: Dan Scott --- diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD.pm b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD.pm index 48f00cb1a7..5b728c039d 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD.pm @@ -357,6 +357,8 @@ sub get_compressed_holdings { @decomp_holdings = $self->get_decompressed_holdings($caption, {'dedupe' => 1}); } + return () if !@decomp_holdings; + my $runner = $decomp_holdings[0]->clone->increment; my $curr_holding = shift(@decomp_holdings); $curr_holding = $curr_holding->clone; @@ -414,6 +416,9 @@ sub get_decompressed_holdings { my $link_id = $caption->link_id; $htag =~ s/^85/86/; my @holdings = $self->holdings($htag, $link_id); + + return () if !@holdings; + my @decomp_holdings; foreach my $holding (@holdings) {