--- a/src/eric7/QScintilla/Editor.py Fri Nov 24 14:59:26 2023 +0100 +++ b/src/eric7/QScintilla/Editor.py Sat Nov 25 18:19:21 2023 +0100 @@ -6710,6 +6710,11 @@ if line == 0: line = 1 # hack to show a syntax error marker, if line is reported to be 0 + + line = min(line, self.lines()) + # Limit the line number to the ones we really have to ensure proper display + # of the error annotation. + if setError: # set a new syntax error marker markers = self.markersAtLine(line - 1) @@ -6864,6 +6869,11 @@ if line == 0: line = 1 # hack to show a warning marker, if line is reported to be 0 + + line = min(line, self.lines()) + # Limit the line number to the ones we really have to ensure proper display + # of the warning annotation. + if setWarning: # set/amend a new warning marker warn = (msg, warningType)