[PATCH 09/10] Don't crash when no valid patches are found

Konstantin Ryabitsev <[email protected]> Fri, 2 Oct 2020 19:29:14 -0400
Newsgroups org.kernel.lore.signatures
Message-ID <[email protected]>
Error out when we don't find any patches in an mbox when trying to diff
series.

Reported-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Konstantin Ryabitsev <[email protected]>
---
 b4/diff.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/b4/diff.py b/b4/diff.py
index 81e015a..10f3159 100644
--- a/b4/diff.py
+++ b/b4/diff.py
@@ -101,6 +101,9 @@ def diff_mboxes(cmdargs):
         lmbx = b4.LoreMailbox()
         for key, msg in mbx.items():
             lmbx.add_message(msg)
+        if len(lmbx.series) < 1:
+            logger.critical('No valid patches found in %s', mboxfile)
+            sys.exit(1)
         if len(lmbx.series) > 1:
             logger.critical('More than one series version in %s, will use latest', mboxfile)
 
-- 
2.26.2