From 1d45bf88a97ad22f529203c5dbd426ab13d812d4 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 27 Mar 2024 12:19:34 +0000 Subject: [PATCH] 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 Signed-off-by: Emily Lamancusa Signed-off-by: Katrin Fischer (cherry picked from commit a37ebc77b7f3513b2775ebb8819a710e5a2eb416) Signed-off-by: Fridolin Somers --- catalogue/MARCdetail.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl index 3f5e03a090..0b7f470b22 100755 --- a/catalogue/MARCdetail.pl +++ b/catalogue/MARCdetail.pl @@ -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 -- 2.39.5