avoid warning

"substr outside of string"
master
Joey Hess 2008-06-03 23:58:19 -04:00
parent 7fc29119db
commit 9c717d0873
1 changed files with 6 additions and 4 deletions

View File

@ -92,10 +92,12 @@ sub filter (@) { #{{{
# if it stopped in the middle of a word. # if it stopped in the middle of a word.
my $size=512; my $size=512;
my ($sample)=substr($toindex, 0, $size); my ($sample)=substr($toindex, 0, $size);
my $next=substr($toindex, $size++, 1); if (length($sample) == $size) {
while (defined $next && $next !~ /\s/) { my $next=substr($toindex, $size++, 1);
$sample.=$next; while (defined $next && $next !~ /\s/) {
$next=substr($toindex, $size++, 1); $sample.=$next;
$next=substr($toindex, $size++, 1);
}
} }
$sample=~s/\n/ /g; $sample=~s/\n/ /g;