From dfa55cea3d1fdb4e024d97edf03518253fd74d7b Mon Sep 17 00:00:00 2001 From: Yordan Miladinov Date: Sat, 4 Dec 2021 14:32:55 +0200 Subject: [PATCH] project/sources: check if re.findall actually matches before using result --- brownie/project/sources.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/brownie/project/sources.py b/brownie/project/sources.py index ebf3e434c..3377c72dd 100644 --- a/brownie/project/sources.py +++ b/brownie/project/sources.py @@ -191,11 +191,13 @@ def get_contract_names(full_source: str) -> List: contract_names = [] for source in contracts: - type_, name, _ = re.findall( + matches = re.findall( r"(abstract contract|contract|library|interface)\s+(\S*)\s*(?:is\s+([\s\S]*?)|)(?:{)", source, - )[0] - contract_names.append((name, type_)) + ) + if matches: + type_, name, _ = matches[0] + contract_names.append((name, type_)) return contract_names