From f81149c379b8e1b4e4571afdd67fb1e4d9f8fec0 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. --- C4/AuthoritiesMarc.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 2671cd4..1a6fb2e 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); } -- 1.7.9.5