* [PATCH] ds: write: do not assume final wbuf entry is tmpio
@ 2023-02-24 16:59 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2023-02-24 16:59 UTC (permalink / raw)
To: meta
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;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-24 16:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-24 16:59 [PATCH] ds: write: do not assume final wbuf entry is tmpio Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).