From: Mark Wooding Date: Sun, 11 Jun 2023 16:45:31 +0000 (+0100) Subject: mason/.perl-lib/TrivGal.pm (listdir): Set item before setting index. X-Git-Url: https://git.distorted.org.uk/~mdw/tgal/commitdiff_plain/0485371ea73360e10ac5f2558788b4ff29abae53 mason/.perl-lib/TrivGal.pm (listdir): Set item before setting index. Otherwise we set the index to the /previous/ item, which doesn't go so well. I don't know why I never noticed this before. --- diff --git a/mason/.perl-lib/TrivGal.pm b/mason/.perl-lib/TrivGal.pm index 193f122..eb82db2 100644 --- a/mason/.perl-lib/TrivGal.pm +++ b/mason/.perl-lib/TrivGal.pm @@ -305,6 +305,7 @@ sub listdir ($) { $/x; $name = urldecode $name; my $list; + $item = TrivGal::Item->new($name); if ($name =~ m#/$#) { $list = \@d; die "can't index a folder" if $indexp; @@ -317,7 +318,6 @@ sub listdir ($) { $ix = $item; } } - $item = TrivGal::Item->new($name); $comment = $c; push @$list, $item; }