From: Dan Scott Date: Wed, 7 Sep 2011 06:41:43 +0000 (-0400) Subject: Protect against undefined value as ARRAY reference X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=67a9cbcf7e20bd3711a7d207fa47fe4f68fe2e7d;p=contrib%2FConifer.git Protect against undefined value as ARRAY reference We should not assume that the caller is going to supply an array (empty or not) of addresses or cards in the input values for the open-ils.actor.patron.update method. Signed-off-by: Dan Scott Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm index ebb56a15d1..ad6fabc176 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm @@ -669,7 +669,9 @@ sub _add_update_addresses { my $current_id; # id of the address before creation - for my $address (@{$patron->addresses()}) { + my $addresses = $patron->addresses(); + + for my $address (@$addresses) { next unless ref $address; $current_id = $address->id(); @@ -779,7 +781,9 @@ sub _add_update_cards { my $evt; my $virtual_id; #id of the card before creation - for my $card (@{$patron->cards()}) { + + my $cards = $patron->cards(); + for my $card (@$cards) { $card->usr($new_patron->id());