[Koha-patches] [PATCH] Trapping fatal error that occurs if you call GetCOinsBiblio with a biblionumber that doesn't exist in the Koha database

Chris Cormack chrisc at catalyst.net.nz
Mon Mar 22 23:21:21 CET 2010


---
 C4/Biblio.pm |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index 17796f3..9669752 100755
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -1146,6 +1146,11 @@ sub GetCOinSBiblio {
     my $record = GetMarcBiblio($biblionumber);
 
     # get the coin format
+    if ( ! $record ) {
+	# can't get a valid MARC::Record object, bail out at this point
+	warn "We called GetMarcBiblio with a biblionumber that doesn't exist biblionumber=$biblionumber";
+	return;
+    }
     my $pos7 = substr $record->leader(), 7, 1;
     my $pos6 = substr $record->leader(), 6, 1;
     my $mtx;
-- 
1.6.3.3




More information about the Koha-patches mailing list