]> sipb.mit.edu Git - ikiwiki.git/commitdiff
$common_prefix may never get defined
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 22 Sep 2007 17:55:32 +0000 (17:55 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 22 Sep 2007 17:55:32 +0000 (17:55 +0000)
IkiWiki/Plugin/map.pm

index 93ff3194a53d57eaff8b11dd2e26b1faf1354371..65a6ed552e9b28ebf7abb516543e2575200a5aca 100644 (file)
@@ -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(\/|$)/) {