From e46b24f437639e3c2cc19df4a2c875b56fe6fea7 Mon Sep 17 00:00:00 2001
From: Eric Wong <e@80x24.org>
Date: Thu, 7 Oct 2021 08:29:32 +0000
Subject: [PATCH] overidx: each_by_mid: account for messages being deleted

This may fix some extindex problems and should get rid of
the "Can't bless non-reference value" errors.
---
 lib/PublicInbox/OverIdx.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/OverIdx.pm b/lib/PublicInbox/OverIdx.pm
index 0c8a4d9e..985abbf4 100644
--- a/lib/PublicInbox/OverIdx.pm
+++ b/lib/PublicInbox/OverIdx.pm
@@ -158,7 +158,8 @@ SELECT $cols FROM over WHERE over.num = ? LIMIT 1
 
 		foreach (@$nums) {
 			$sth->execute($_->[0]);
-			my $smsg = $sth->fetchrow_hashref;
+			# $cb may delete rows and invalidate nums
+			my $smsg = $sth->fetchrow_hashref // next;
 			$smsg = PublicInbox::Over::load_from_row($smsg);
 			$cb->($self, $smsg, @arg) or return;
 		}
-- 
2.51.0