source: fix crash when len(source) is zero!
This commit is contained in:
parent
c2751847d8
commit
6778a5e5c8
1 changed files with 1 additions and 1 deletions
|
|
@ -126,7 +126,7 @@ class SourceLocation:
|
|||
|
||||
def show_in_source(self) -> str:
|
||||
source = self.source.splitlines(keepends=False)
|
||||
line_number_maxlen = int(math.log10(len(source)) + 1)
|
||||
line_number_maxlen = 1 if not len(source) else int(math.log10(len(source)) + 1)
|
||||
lines = source[self.begin.line:self.end.line + 1]
|
||||
result = []
|
||||
begin_char = self.begin.character
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue