From 9f9ced95c1ddddb7fa115be6b8317ccdbb6d41b1 Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Mon, 18 Nov 2024 20:45:55 +0100 Subject: [PATCH] fix 0-line files --- vyper/ast/parse.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vyper/ast/parse.py b/vyper/ast/parse.py index 7c3f285050..20cc483a63 100644 --- a/vyper/ast/parse.py +++ b/vyper/ast/parse.py @@ -196,7 +196,11 @@ def generic_visit(self, node): node.lineno = 1 node.col_offset = 0 node.end_lineno = len(self.source_lines) - node.end_col_offset = len(self.source_lines[-1]) + + if len(self.source_lines) > 0: + node.end_col_offset = len(self.source_lines[-1]) + else: + node.end_col_offset = 0 adjustments = self._pre_parse_result.adjustments