aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-06-03 23:58:19 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-06-03 23:58:19 -0400
commit9c717d087340fa2c9db1e02fbc07ba0ef05775de (patch)
tree3505784ca451f7bc3576f8ea62fd11a2c88515cc /IkiWiki/Plugin
parent7fc29119dbd953b60f1dd2e9f59473afab2a21fa (diff)
downloadikiwiki-9c717d087340fa2c9db1e02fbc07ba0ef05775de.tar
ikiwiki-9c717d087340fa2c9db1e02fbc07ba0ef05775de.tar.gz
avoid warning
"substr outside of string"
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/search.pm10
1 files changed, 6 insertions, 4 deletions
diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm
index 679321ce5..0218987d0 100644
--- a/IkiWiki/Plugin/search.pm
+++ b/IkiWiki/Plugin/search.pm
@@ -92,10 +92,12 @@ sub filter (@) { #{{{
# if it stopped in the middle of a word.
my $size=512;
my ($sample)=substr($toindex, 0, $size);
- my $next=substr($toindex, $size++, 1);
- while (defined $next && $next !~ /\s/) {
- $sample.=$next;
- $next=substr($toindex, $size++, 1);
+ if (length($sample) == $size) {
+ my $next=substr($toindex, $size++, 1);
+ while (defined $next && $next !~ /\s/) {
+ $sample.=$next;
+ $next=substr($toindex, $size++, 1);
+ }
}
$sample=~s/\n/ /g;