]> Sergey Matveev's repositories - public-inbox.git/commitdiff
extmsg: avoid exceptions when /all/$MSGID/ fails
authorEric Wong <e@80x24.org>
Thu, 10 Dec 2020 23:04:50 +0000 (23:04 +0000)
committerEric Wong <e@80x24.org>
Fri, 11 Dec 2020 03:38:08 +0000 (03:38 +0000)
If a message can't be found in ->ALL, we shouldn't attempt to
enter code paths which iterate normal inboxes or attempt to
access non-existent fields (e.g. {name}, {newsgroup},
{inboxdir}) in the ExtSearch object.

lib/PublicInbox/ExtMsg.pm

index 8da96df699c2bba7c741e0d79bf2739914794ef1..6a173f675444b48216ba143b5c44e4fec764420f 100644 (file)
@@ -107,7 +107,8 @@ sub ext_msg_ALL ($) {
        my ($ctx) = @_;
        my $ALL = $ctx->{www}->{pi_cfg}->ALL or return;
        my $by_eidx_key = $ctx->{www}->{pi_cfg}->{-by_eidx_key};
-       my $cur_key = $ctx->{ibx}->eidx_key;
+       my $cur_key = eval { $ctx->{ibx}->eidx_key } //
+                       return partial_response($ctx); # $cur->{ibx} == $ALL
        my %seen = ($cur_key => 1);
        my ($id, $prev);
        while (my $x = $ALL->over->next_by_mid($ctx->{mid}, \$id, \$prev)) {