From 436ade8e24563c134d1689d7f0fb3b74732c4d2a Mon Sep 17 00:00:00 2001 From: bosd Date: Sun, 25 Sep 2022 11:48:47 +0200 Subject: [PATCH] fixup when no content is matched between start and end --- src/invoice2data/extract/parsers/lines.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/invoice2data/extract/parsers/lines.py b/src/invoice2data/extract/parsers/lines.py index 32cfd12e..38bdb078 100644 --- a/src/invoice2data/extract/parsers/lines.py +++ b/src/invoice2data/extract/parsers/lines.py @@ -87,6 +87,10 @@ def parse(template, field, _settings, content): # Strip the content down to the items between start and end tag of this setting start = re.search(setting["start"], content) end = re.search(setting["end"], content) + if not start or not end: + logger.warning(f"No content found between:\n Start match: {start}.\n End match: {end}") + continue + content_of_setting = content[start.end() : end.start()] # search if the current line is in the content.