diff --git a/components/synedit/synedithighlighterfoldbase.pas b/components/synedit/synedithighlighterfoldbase.pas index cea03020cd..9bdff34958 100644 --- a/components/synedit/synedithighlighterfoldbase.pas +++ b/components/synedit/synedithighlighterfoldbase.pas @@ -1297,7 +1297,7 @@ begin if (FEvaluationIndex = FCount) then begin FPreviousMergeLine := -1; i := FPreviousCount; // + 1 - 1 - if i > 0 then begin + if (i > 0) and (FPreviousEvaluationIndex < i) then begin if i >= Length(FPreviousNestInfo) then exit; if (i > FPreviousEvaluationIndex) and diff --git a/components/synedit/test/testfoldedview.pas b/components/synedit/test/testfoldedview.pas index 65197b49a8..93c3a0c7b1 100644 --- a/components/synedit/test/testfoldedview.pas +++ b/components/synedit/test/testfoldedview.pas @@ -2463,6 +2463,21 @@ begin end; {%endregion TestText12} + {%region cache from previous access} + PushBaseName('cache'); + TstSetText('TestText1', TestText1); + TheList := FoldedView.FoldProvider.NestedFoldsList; + EnableFolds([cfbtBeginEnd..cfbtNone]); + PrepareLine := -1; + + InitList('All Enabled ', TheList, 1, 0, [], False, True); + TheList.Count; // only access count + TheList.Line := 8; + TheList.HLNode[0]; // do not crash // group levels are not initialized + + PopBaseName; + {%endregion cache} + PopBaseName;PopBaseName; end;