Protect against the horrifying possibility that a caption might not exist
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 22 May 2009 14:18:08 +0000 (14:18 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 22 May 2009 14:18:08 +0000 (14:18 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13215 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm

index c821a67..1c20485 100755 (executable)
@@ -28,7 +28,7 @@ sub new {
     foreach my $subfield ($self->subfields) {
        my ($key, $val) = @$subfield;
 
-       if (($caption->enumeration_is_chronology && $key =~ /[a-h]/) || $key =~ /[i-m]/) {
+       if (($caption && $caption->enumeration_is_chronology && $key =~ /[a-h]/) || $key =~ /[i-m]/) {
            # Chronology
            $self->{_mfhdh_SUBFIELDS}->{$key} = $val;
        } elsif ($key =~ /[a-h]/) {
@@ -238,7 +238,7 @@ sub validate {
     my $self = shift;
 
     foreach my $key (keys %{$self->{_mfhdh_SUBFIELDS}}) {
-       if (!$self->{_mfhdh_CAPTION}->capfield($key)) {
+       if (!($self->{_mfhdh_CAPTION}) && $self->{_mfhdh_CAPTION}->capfield($key)) {
            return 0;
        }
     }