summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki/Plugin/map.pm6
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(\/|$)/) {