From 6dc2571a4c04950c17d55a39f09c90f3d78046a8 Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 4 Nov 2017 14:44:04 +0000 Subject: [PATCH] codetools: ReduceCompilerDirectives fixed crash git-svn-id: trunk@56279 - --- components/codetools/directivestree.pas | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/codetools/directivestree.pas b/components/codetools/directivestree.pas index d2eb1579bf..b5aaf0c735 100644 --- a/components/codetools/directivestree.pas +++ b/components/codetools/directivestree.pas @@ -925,6 +925,8 @@ begin } NextSubNode:=SubNode.NextSkipChilds; DebugLn(['TCompilerDirectivesTree.MoveIfNotThenDefsUp IFDEF + DEFINE => the define is not needed']); + if NextNode=SubNode then + NextNode:=NextNode.NextSkipChilds; DisableDefineNode(SubNode,Changed); SubNode:=nil; end; @@ -972,6 +974,8 @@ begin // the name was not read after it was set -> disable the define // in the block DebugLn(['TCompilerDirectivesTree.MoveIfNotThenDefsUp old DEFINE is not needed anymore']); + if NextNode=LastDefineNode then + NextNode:=NextNode.NextSkipChilds; DisableDefineNode(LastDefineNode,Changed); end; end;