Bug 5182 - Attempting to export a patron card with no text causes an error to be...
authorChris Nighswonger <cnighswonger@foundations.edu>
Wed, 8 Sep 2010 20:03:15 +0000 (16:03 -0400)
committerChris Nighswonger <cnighswonger@foundations.edu>
Fri, 10 Sep 2010 22:28:30 +0000 (18:28 -0400)
Can't use an undefined value as an ARRAY reference at /home/koha/koha.prod/C4/Patroncards/Patroncard.pm line 86.

This is caused by testing for text at line 87 rather than line 85. This patch moves the test to line 85.

C4/Patroncards/Patroncard.pm

index 2093976..23cba15 100644 (file)
@@ -83,8 +83,8 @@ sub draw_text {
     my ($self, $pdf, %params) = @_;
     warn sprintf('No pdf object passed in.') and return -1 if !$pdf;
     my @card_text = ();
+    return unless (ref($self->{'layout'}->{'text'}) eq 'ARRAY'); # just in case there is not text
     my $text = [@{$self->{'layout'}->{'text'}}]; # make a copy of the arrayref *not* simply a pointer
-    return unless (ref($text) eq 'ARRAY'); # just in case there is not text
     while (scalar @$text) {
         my $line = shift @$text;
         my $parse_line = $line;