about summary refs log tree commit homepage
path: root/lib/PublicInbox/DS.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-02-24 16:59:10 +0000
committerEric Wong <e@80x24.org>2023-02-26 16:44:03 +0000
commit0f334acf7b3a4fc8aac52d0281e9c2af97d8addd (patch)
treeb68f25b64bd6d1ae1768e93d54da18ecb4a7eae7 /lib/PublicInbox/DS.pm
parentf0e6740e67da446d462fc267d9be2e0bff0de9c4 (diff)
downloadpublic-inbox-0f334acf7b3a4fc8aac52d0281e9c2af97d8addd.tar.gz
The final entry of {wbuf} may be a CODE ref and not a
tmpio ARRAY ref, so we must ensure it's an ARRAY before
attempting to use `->[INDEX]' to access it.

This fixes:
  forward ->close error: Not an ARRAY reference at PublicInbox/DS.pm line 544.
Diffstat (limited to 'lib/PublicInbox/DS.pm')
-rw-r--r--lib/PublicInbox/DS.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm
index 0a763d0e..a08e01f5 100644
--- a/lib/PublicInbox/DS.pm
+++ b/lib/PublicInbox/DS.pm
@@ -541,7 +541,8 @@ sub write {
             push @$wbuf, $bref;
         } else {
             my $tmpio = $wbuf->[-1];
-            if ($tmpio && !defined($tmpio->[2])) { # append to tmp file buffer
+            if (ref($tmpio) eq 'ARRAY' && !defined($tmpio->[2])) {
+                # append to tmp file buffer
                 $tmpio->[0]->print($$bref) or return drop($self, "print: $!");
             } else {
                 my $tmpio = tmpio($self, $bref, 0) or return 0;