From cc9b23d3d72418492c43d34222128541cda1aced Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Thu, 11 Oct 2012 15:05:07 -0400 Subject: [PATCH] Bug 8905: Error when accessing invalid authority The GetAuthority shim does not check that authority retrieval was successful, and therefore can call ->record on an undefined value. This can be reproduced by trying to load an invalid authority record using bulkmarcimport. There may be other ways to trigger it, but I'm not sure what they are. Signed-off-by: Kyle M Hall Signed-off-by: Paul Poulain another way to trigger this error is just forging your URL with a wrong authid ! --- C4/AuthoritiesMarc.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index dde1c0547d..114e59338d 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -856,6 +856,7 @@ Returns MARC::Record of the authority passed in parameter. sub GetAuthority { my ($authid)=@_; my $authority = Koha::Authority->get_from_authid($authid); + return unless $authority; return ($authority->record); } -- 2.39.5