From 7e9978814893541bc205a7f03a8e2c8e38e1d190 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 Content-Type: text/plain; charset="utf-8" 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 --- C4/AuthoritiesMarc.pm | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) 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.2.5