From ad3d5a8d4e90915bf16fc4b07995963f34e40d0a Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Fri, 12 Jun 2020 10:44:42 -0400 Subject: Fix crash with unbalanced [] in subject Don't crash if there is no matching ] in the subject. The culprit: https://lore.kernel.org/lkml/20200612142621.GA8009@lenoir Signed-off-by: Konstantin Ryabitsev --- b4/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/b4/__init__.py b/b4/__init__.py index 641cc70..c85b85e 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -1382,6 +1382,8 @@ class LoreSubject: # Find all [foo] in the title while subject.find('[') == 0: matches = re.search(r'^\[([^\]]*)\]', subject) + if not matches: + break for chunk in matches.groups()[0].split(): # Remove any trailing commas or semicolons chunk = chunk.strip(',;') -- cgit v1.2.3