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.
---
lib/PublicInbox/DS.pm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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;