Bug 10500: (follow-up) add checks for empty isbn
authorKyle M Hall <kyle@bywatersolutions.com>
Wed, 16 Apr 2014 15:03:54 +0000 (11:03 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 5 May 2014 18:06:08 +0000 (18:06 +0000)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Koha.pm

index 062a98f..5988249 100644 (file)
@@ -1564,7 +1564,7 @@ sub _isbn_cleanup {
             format        => 'ISBN-10',
             strip_hyphens => 1,
         }
-    );
+    ) if $isbn;
 }
 
 =head2 NormalizedISBN
@@ -1591,6 +1591,8 @@ sub NormalizeISBN {
     my $strip_hyphens = $params->{strip_hyphens};
     my $format        = $params->{format};
 
+    return unless $string;
+
     my $isbn = Business::ISBN->new($string);
 
     if ( $isbn && $isbn->error != Business::ISBN::BAD_ISBN ) {
@@ -1628,6 +1630,8 @@ sub NormalizeISBN {
 sub GetVariationsOfISBN {
     my ($isbn) = @_;
 
+    return unless $isbn;
+
     my @isbns;
 
     push( @isbns, NormalizeISBN({ isbn => $isbn }) );