diff --git a/dlibrary/dlibrary.py b/dlibrary/dlibrary.py index d0c17dc..14adba3 100755 --- a/dlibrary/dlibrary.py +++ b/dlibrary/dlibrary.py @@ -816,7 +816,10 @@ def unique_hierarchical_prefix_numbering(entries, start_point=0): ents_idx = numbering.pop(idx) debug(f'Index {idx} has multiple entries') longest = max(ents_idx, key=lambda e: len(nname(e))) - next_layer_start = pos + NUMBER_REGEX.match(nname(longest)[pos:]).end() + next_match = NUMBER_REGEX.match(nname(longest)[pos:]) + if not next_match: + return None + next_layer_start = pos + next_match.end() sub_numbering = unique_hierarchical_prefix_numbering(ents_idx, start_point=next_layer_start) or alphabetic_numbering(ents_idx, next_layer_start) if not sub_numbering: return None