From 973adba104e4915d68003220ac8b7f02af904481 Mon Sep 17 00:00:00 2001 From: Paul POULAIN Date: Wed, 31 Oct 2007 13:12:13 -0500 Subject: [PATCH] dealing with empty XML : return an empty string, and not an empty MARC::Record (Useful for zebraque_start) Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Biblio.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index b7b559dc5e..6c9fe4ea16 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1611,11 +1611,14 @@ sub GetMarcBiblio { $marcxml =~ s/\x0c//g; # warn $marcxml; my $record = MARC::Record->new(); - - $record = eval {MARC::Record::new_from_xml( $marcxml, "utf8",C4::Context->preference('marcflavour'))} if ($marcxml); - if ($@) {warn $@;} + if ($marcxml) { + $record = eval {MARC::Record::new_from_xml( $marcxml, "utf8", C4::Context->preference('marcflavour'))}; + if ($@) {warn $@;} # $record = MARC::Record::new_from_usmarc( $marc) if $marc; - return $record; + return $record; + } else { + return undef; + } } =head2 GetXmlBiblio -- 2.39.5