diff options
author | Eric Wong <e@80x24.org> | 2021-09-27 16:05:45 -0500 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-09-27 21:08:35 +0000 |
commit | 010159a7b789a3a27c917a5378db92c8adf78a9e (patch) | |
tree | 002f8a98c656ed2395a446206e14b05506e8b5d6 /lib/PublicInbox/LeiImport.pm | |
parent | 81a0962fa9798c4fb0ab234ed54f3e886996a8a0 (diff) | |
download | public-inbox-010159a7b789a3a27c917a5378db92c8adf78a9e.tar.gz |
While `$argv[-1]' is `undef' on an empty @argv, using `$argv[-1]' as a subroutine argument would fail incorrectly with: Modification of non-creatable array value attempted, subscript -1 at ... ...even though we'd never attempt to modify @_ itself in the subroutines being called. Work around the bug (tested on 5.16.3) by passing `undef' explicitly when `$argv[-1]' is already `undef'. Reported-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Link: https://public-inbox.org/meta/20210927124056.kj5okiefvs4ztk27@meerkat.local/
Diffstat (limited to 'lib/PublicInbox/LeiImport.pm')
-rw-r--r-- | lib/PublicInbox/LeiImport.pm | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/LeiImport.pm b/lib/PublicInbox/LeiImport.pm index 397292d4..69d63ab6 100644 --- a/lib/PublicInbox/LeiImport.pm +++ b/lib/PublicInbox/LeiImport.pm @@ -122,11 +122,11 @@ sub lei_import { # the main "lei import" method sub _complete_import { my ($lei, @argv) = @_; my ($re, $cur, $match_cb) = $lei->complete_url_prepare(\@argv); - my @k = $lei->url_folder_cache->keys($argv[-1], 1); + my @k = $lei->url_folder_cache->keys($argv[-1] // undef, 1); my @m = map { $match_cb->($_) } @k; my %f = map { $_ => 1 } (@m ? @m : @k); if (my $lms = $lei->lms) { - @k = $lms->folders($argv[-1], 1); + @k = $lms->folders($argv[-1] // undef, 1); @m = map { $match_cb->($_) } @k; if (@m) { @f{@m} = @m } else { @f{@k} = @k } } |