From 63703b883c53d29543c51237c79e958d1cae02d2 Mon Sep 17 00:00:00 2001 From: martin Date: Sun, 5 Apr 2009 14:13:27 +0000 Subject: [PATCH] SynEdit: Fix crash using the Delphi highlighter (introduced in revision 19220 #9918770992) issue #13467 git-svn-id: trunk@19229 - --- ide/editoroptions.pp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ide/editoroptions.pp b/ide/editoroptions.pp index 15127be7bb..a28c695a33 100644 --- a/ide/editoroptions.pp +++ b/ide/editoroptions.pp @@ -2319,10 +2319,12 @@ var Path: String; i: Integer; begin + i := HighlighterList.FindByHighlighter(Syn); + if i < 0 then exit; + TheInfo := EditorOptionsDividerDefaults[HighlighterList[i].TheType]; + ReadDefaultsForHighlighterFoldSettings(Syn); - TheInfo := EditorOptionsDividerDefaults - [HighlighterList[HighlighterList.FindByHighlighter(Syn)].TheType]; // read settings, that are different from the defaults for i := 0 to TheInfo.Count - 1 do begin Conf := Syn.DividerDrawConfig[i]; @@ -2343,8 +2345,9 @@ var TheInfo: TEditorOptionsDividerRecord; i: Integer; begin - TheInfo := EditorOptionsDividerDefaults - [HighlighterList[HighlighterList.FindByHighlighter(Syn)].TheType]; + i := HighlighterList.FindByHighlighter(Syn); + if i < 0 then exit; + TheInfo := EditorOptionsDividerDefaults[HighlighterList[i].TheType]; for i := 0 to TheInfo.Count - 1 do begin Syn.DividerDrawConfig[i].MaxDrawDepth := TheInfo.Info^[i].MaxLeveL; Syn.DividerDrawConfig[i].TopColor := clDefault; @@ -2361,12 +2364,13 @@ var TheInfo: TEditorOptionsDividerRecord; ConfName: String; begin + i := HighlighterList.FindByHighlighter(Syn); + if i < 0 then exit; + TheInfo := EditorOptionsDividerDefaults[HighlighterList[i].TheType]; + DefSyn := TCustomSynClass(Syn.ClassType).Create(Nil); try ReadDefaultsForHighlighterFoldSettings(DefSyn); - - TheInfo := EditorOptionsDividerDefaults - [HighlighterList[HighlighterList.FindByHighlighter(Syn)].TheType]; for i := 0 to TheInfo.Count - 1 do begin Conf := Syn.DividerDrawConfig[i]; DefConf := DefSyn.DividerDrawConfig[i]; // default value