diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-09-22 17:55:32 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-09-22 17:55:32 +0000 |
commit | a0f55abe072d19b623c65e74f2ede905d4c3f997 (patch) | |
tree | 232606298a0e4de19a8ab18c84ce8c2e765e52d2 | |
parent | ae3c65f93458be6136a82b4ad04b967c00c44b63 (diff) |
$common_prefix may never get defined
-rw-r--r-- | IkiWiki/Plugin/map.pm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm index 93ff3194a..65a6ed552 100644 --- a/IkiWiki/Plugin/map.pm +++ b/IkiWiki/Plugin/map.pm @@ -45,7 +45,8 @@ sub preprocess (@) { #{{{ } # Common prefix should not be a page in the map. - while (length $common_prefix && exists $mapitems{$common_prefix}) { + while (defined $common_prefix && length $common_prefix && + exists $mapitems{$common_prefix}) { $common_prefix=IkiWiki::dirname($common_prefix); } @@ -62,7 +63,8 @@ sub preprocess (@) { #{{{ my $openli=0; my $map = "<div class='map'>\n<ul>\n"; foreach my $item (sort keys %mapitems) { - $item=~s/^\Q$common_prefix\E\/// if length $common_prefix; + $item=~s/^\Q$common_prefix\E\/// + if defined $common_prefix && length $common_prefix; my $depth = ($item =~ tr/\//\//) + 1; my $baseitem=IkiWiki::dirname($item); while (length $parent && length $baseitem && $baseitem !~ /^\Q$parent\E(\/|$)/) { |