File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -987,7 +987,7 @@ def format_messages(
987
987
a .append (s )
988
988
if self .options .pretty :
989
989
# Add source code fragment and a location marker.
990
- if severity == "error" and source_lines and line > 0 :
990
+ if severity == "error" and source_lines and len ( source_lines ) >= line > 0 :
991
991
source_line = source_lines [line - 1 ]
992
992
source_line_expanded = source_line .expandtabs ()
993
993
if column < 0 :
@@ -1201,7 +1201,10 @@ def render_messages(
1201
1201
)
1202
1202
)
1203
1203
src = (
1204
- file == current_file and source_lines and e .line > 0 and source_lines [e .line - 1 ]
1204
+ file == current_file
1205
+ and source_lines
1206
+ and len (source_lines ) >= e .line > 0
1207
+ and source_lines [e .line - 1 ]
1205
1208
) or ""
1206
1209
# when there is no column, but we still want an ide to show an error
1207
1210
if e .column == - 1 and self .options .show_error_end :
You can’t perform that action at this time.
0 commit comments