about summary refs log tree commit homepage
path: root/lib/PublicInbox/Qspawn.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/Qspawn.pm')
-rw-r--r--lib/PublicInbox/Qspawn.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm
index cea34fc3..ef9db43e 100644
--- a/lib/PublicInbox/Qspawn.pm
+++ b/lib/PublicInbox/Qspawn.pm
@@ -225,19 +225,19 @@ sub psgi_return_init_cb {
         my ($self) = @_;
         my $r = rd_hdr($self) or return;
         my $env = $self->{psgi_env};
-        my $filter = delete $env->{'qspawn.filter'} //
-                PublicInbox::GzipFilter::qsp_maybe($r->[1], $env);
+        my $filter = delete($env->{'qspawn.filter'}) // (ref($r) eq 'ARRAY' ?
+                PublicInbox::GzipFilter::qsp_maybe($r->[1], $env) : undef);
 
         my $wcb = delete $env->{'qspawn.wcb'};
         my $async = delete $self->{async}; # PublicInbox::HTTPD::Async
-        if (scalar(@$r) == 3) { # error
+        if (ref($r) ne 'ARRAY' || scalar(@$r) == 3) { # error
                 if ($async) { # calls rpipe->close && ->event_step
                         $async->close; # PublicInbox::HTTPD::Async::close
                 } else {
                         $self->{rpipe}->close;
                         event_step($self);
                 }
-                $wcb->($r);
+                $wcb->($r) if ref($r) eq 'ARRAY';
         } elsif ($async) {
                 # done reading headers, handoff to read body
                 my $fh = $wcb->($r); # scalar @$r == 2