From 5d6e3d8e47af6c787ca2cc32e873478fb5c3ba55 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 22 May 2021 22:58:12 -0400 Subject: Avoid type error when local mbox lacks specified message ID Calling b4-am with --use-local=MBOX is supposed to abort with "Could not find MID in MBOX" if the mbox doesn't contain the specified message ID. As of 4950093c0 (Don't use mboxo for anything, 2021-05-18), a type error is signaled because get_strict_thread() returns None when there are no matches, and get_msgs() feeds this result to len(). Update get_msgs() to instead check whether the returned value evaluates to false. Signed-off-by: Kyle Meyer Signed-off-by: Konstantin Ryabitsev Link: https://lore.kernel.org/r/20210523025812.26456-1-kyle@kyleam.com --- b4/mbox.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'b4/mbox.py') diff --git a/b4/mbox.py b/b4/mbox.py index a4b005f..bf1a586 100644 --- a/b4/mbox.py +++ b/b4/mbox.py @@ -572,7 +572,7 @@ def get_msgs(cmdargs) -> Tuple[Optional[str], Optional[list]]: if msgid: msgs = b4.get_strict_thread(in_mbx, msgid) - if not len(msgs): + if not msgs: logger.critical('Could not find %s in %s', msgid, cmdargs.localmbox) sys.exit(1) else: -- cgit v1.2.3