From f7f9506f96d7c3bc4de46353e6f73c9c1aafe92e Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Thu, 7 Mar 2024 17:34:36 +0100 Subject: [PATCH] Fix crash in 'updatepacmetafromspec' command when working with an incomplete spec --- osc/core.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osc/core.py b/osc/core.py index 0965089d..a808c550 100644 --- a/osc/core.py +++ b/osc/core.py @@ -4370,8 +4370,10 @@ def read_meta_from_spec(specfile, *args): section_pat = r'^%s\s*?$' for section in sections: m = re.compile(section_pat % section, re.I | re.M).search(''.join(lines)) - if m: - start = lines.index(m.group() + '\n') + 1 + if m is None: + spec_data[section] = "" + continue + start = lines.index(m.group() + '\n') + 1 data = [] for line in lines[start:]: if line.startswith('%'):