Bug 36438: Check object for calling metadata

Resolve: Can't call method "metadata" on an undefined value at catalogue/MARCdetail.pl line 93

The proceeding lines check for $record and respond appropriately.

Test plan:
Call catalogue/MARCdetail.pl with an unexisting biblionumber.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Marcel de Rooy 2024-03-27 12:19:34 +00:00 committed by Katrin Fischer
parent 66e03ef4e5
commit a37ebc77b7
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -90,7 +90,8 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
);
my $biblio_object = Koha::Biblios->find( $biblionumber ); # FIXME Should replace $biblio
my $record = $biblio_object->metadata->record({ embed_items => 1 });
my $record;
$record = $biblio_object->metadata->record({ embed_items => 1 }) if $biblio_object;
if ( not defined $record ) {
# biblionumber invalid -> report and exit