If lei_ls_mail_sync() is given a filter without any wildcards
and --globoff is unspecified, glob2re() will return undef,
resulting in the final regular expression being undefined.
Always use a fallback value when there's no RE.
Based-on-patch-by: Kyle Meyer <kyle@kyleam.com>
Link: https://public-inbox.org/meta/20210504044559.12941-5-kyle@kyleam.com/
my $sto = $lei->_lei_store or return;
my $lms = $sto->search->lms or return;
my $opt = $lei->{opt};
- my $re;
- $re = defined($filter) ? qr/\Q$filter\E/ : qr/./ if $opt->{globoff};
- $re //= $lei->glob2re($filter // '*');
+ my $re = $opt->{globoff} ? undef : $lei->glob2re($filter // '*');
+ $re //= qr/\Q$filter\E/;
my @f = $lms->folders;
@f = $opt->{'invert-match'} ? grep(!/$re/, @f) : grep(/$re/, @f);
if ($opt->{'local'} && !$opt->{remote}) {