From 3ea35a353ff039a8cd7e56bc8341e13dd5b03ce8 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 12 Apr 2024 08:10:18 +0000 Subject: [PATCH] Bug 36552: (QA follow-up) Add a theoretical check on $record Theoretically, it might be empty? Note the check too in the other script. Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer (cherry picked from commit cc834ba187b7d4a4b817d73f5c4be0eb0ebdaaf4) Signed-off-by: Fridolin Somers (cherry picked from commit 7c4ea8ee7f6e214c7c22da4ab1a1c84e6b73e4ba) Signed-off-by: Lucas Gass --- authorities/authorities.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/authorities/authorities.pl b/authorities/authorities.pl index fa595114ef..5837a76e57 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -638,12 +638,12 @@ if ($op eq "add") { } else { if ( $op eq "duplicate" ) { $authid = ""; - if ( C4::Context->preference('marcflavour') eq 'MARC21' && $record->field('008') ) { + if ( C4::Context->preference('marcflavour') eq 'MARC21' && $record && $record->field('008') ) { my $s008 = $record->field('008')->data; my $date = POSIX::strftime( "%y%m%d", localtime ); substr( $s008, 0, 6, $date ); $record->field('008')->update($s008); - } elsif ( C4::Context->preference('marcflavour') eq 'UNIMARC' && $record->subfield( '100', 'a' ) ) { + } elsif ( C4::Context->preference('marcflavour') eq 'UNIMARC' && $record && $record->subfield( '100', 'a' ) ) { my $s100a = $record->subfield( '100', 'a' ); my $date = POSIX::strftime( "%Y%m%d", localtime ); substr( $s100a, 0, 8, $date ); -- 2.39.5