From 432b5fc9dd8e04cfba8a1192e5b325d3b51a6864 Mon Sep 17 00:00:00 2001 From: martin Date: Sun, 9 May 2010 18:26:54 +0000 Subject: [PATCH] SourceEditor: Fix dealing with out-of-range debug-marks git-svn-id: trunk@25283 - --- ide/sourcesyneditor.pas | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ide/sourcesyneditor.pas b/ide/sourcesyneditor.pas index d6f7ea234b..f65c77fc9f 100644 --- a/ide/sourcesyneditor.pas +++ b/ide/sourcesyneditor.pas @@ -235,9 +235,13 @@ begin FDebugMarkInfo.IncRefCount; end; - if ALastLinePos >= FDebugMarkInfo.Count then begin + if ALastLinePos > FDebugMarkInfo.Count then begin debugln(['Request to set debug-mark out of range: max-count=',FDebugMarkInfo.Count,' Marks=',AFirstLinePos,' to=',ALastLinePos]); - ALastLinePos := FDebugMarkInfo.Count -1; + ALastLinePos := FDebugMarkInfo.Count; + end; + if AFirstLinePos < 1 then begin + debugln(['Request to set debug-mark out of range: max-count=',FDebugMarkInfo.Count,' Marks=',AFirstLinePos,' to=',ALastLinePos]); + AFirstLinePos := 1; end; for i := AFirstLinePos - 1 to ALastLinePos - 1 do FDebugMarkInfo[i] := i + 1;