Changeset 19999

Show
Ignore:
Timestamp:
17.07.2009 10:12:29 (10 years ago)
Author:
davidb
Message:

An empty item file caused the code to loop forever. Offending loop now corrected to exit correctly.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugins/PagedImagePlugin.pm

    r19054 r19999  
    330330    my $xml_version = 0; 
    331331    open (ITEMFILE, $filename) || die "couldn't open $filename\n"; 
    332      
     332 
    333333    my $line = ""; 
    334334    my $num = 0; 
     335 
    335336    $line = <ITEMFILE>; 
    336     while ($line !~ /\w/) { 
     337    while (defined ($line) && ($line !~ /\w/)) { 
    337338    $line = <ITEMFILE>; 
    338339    } 
    339     chomp $line; 
    340     if ($line =~ /<PagedDocument/) { 
    341     $xml_version = 1; 
    342     } 
     340 
     341    if (defined $line) { 
     342    chomp $line; 
     343    if ($line =~ /<PagedDocument/) { 
     344        $xml_version = 1; 
     345    } 
     346    }  
     347 
    343348    close ITEMFILE;  
    344349    return $xml_version;