LP#1668816: Prevent Internal Server Error in OPAC when logged-in user has no card
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Wed, 1 Mar 2017 01:28:31 +0000 (17:28 -0800)
committerKathy Lussier <klussier@masslnc.org>
Wed, 1 Mar 2017 15:07:08 +0000 (10:07 -0500)
Signed-off-by: Jeff Davis <jdavis@sitka.bclibraries.ca>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm

index f2f5d8f..6aa1f58 100644 (file)
@@ -302,7 +302,8 @@ sub load_common {
             $ctx->{authtoken} = $e->authtoken;
             $ctx->{authtime} = $e->authtime;
             $ctx->{user} = $e->requestor;
-            $ctx->{active_card} = $self->editor->retrieve_actor_card($ctx->{user}->card)->barcode;
+            my $card = $self->editor->retrieve_actor_card($ctx->{user}->card);
+            $ctx->{active_card} = (ref $card) ? $card->barcode : undef;
             $ctx->{place_unfillable} = 1 if $e->requestor->wsid && $e->allowed('PLACE_UNFILLABLE_HOLD', $e->requestor->ws_ou);
 
             # The browser client does not set an OILS-Wrapper header (above).