unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] content_digest_dbg: handle empty inputs
@ 2023-04-28  9:43 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2023-04-28  9:43 UTC (permalink / raw)
  To: meta

It's possible that we hit messages or attachments with empty
bodies, so avoid doing a regexp match on an uninitialized variable.
---
 lib/PublicInbox/ContentDigestDbg.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/PublicInbox/ContentDigestDbg.pm b/lib/PublicInbox/ContentDigestDbg.pm
index 31d0f707..853624f1 100644
--- a/lib/PublicInbox/ContentDigestDbg.pm
+++ b/lib/PublicInbox/ContentDigestDbg.pm
@@ -11,7 +11,7 @@ sub new { bless [ PublicInbox::SHA->new(256), $_[1] ], __PACKAGE__ }
 sub add {
 	$_[0]->[0]->add($_[1]);
 	my @dbg = split(/^/sm, $_[1]);
-	if ($dbg[0] =~ /\A(To|Cc)\0/) { # fold excessively long lines
+	if (@dbg && $dbg[0] =~ /\A(To|Cc)\0/) { # fold excessively long lines
 		@dbg = map { split(/,/s, $_) } @dbg;
 	}
 	print { $_[0]->[1] } Dumper(\@dbg) or die "print $!";

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-28  9:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-28  9:43 [PATCH] content_digest_dbg: handle empty inputs 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).