From baf0ce059f8c94af948da35097e82ece2cadac45 Mon Sep 17 00:00:00 2001 From: juha Date: Mon, 16 Jun 2014 15:56:06 +0000 Subject: [PATCH] IDE: fix a crash when opening a file with flag [ofRevert] but no editor yet opened for that file. git-svn-id: trunk@45550 - --- ide/sourcefilemanager.pas | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ide/sourcefilemanager.pas b/ide/sourcefilemanager.pas index cd60d01b61..17003842c0 100644 --- a/ide/sourcefilemanager.pas +++ b/ide/sourcefilemanager.pas @@ -1349,7 +1349,7 @@ function TLazSourceFileManager.OpenEditorFile(AFileName: string; PageIndex, var UnitIndex: integer; UnknownFile, Handled: boolean; - NewUnitInfo:TUnitInfo; + NewUnitInfo: TUnitInfo; NewBuf: TCodeBuffer; FilenameNoPath: String; LoadBufferFlags: TLoadBufferFlags; @@ -1427,7 +1427,9 @@ begin UseWindowID := False; assert((WindowIndex >= 0) and (WindowIndex < SourceEditorManager.SourceWindowCount), 'WindowIndex for revert'); AFilename := SourceEditorManager.SourceEditorsByPage[WindowIndex, PageIndex].FileName; - end; + end + else + Flags := Flags - [ofRevert]; // No editor exists yet, don't try to revert. UnitIndex:=Project1.IndexOfFilename(AFilename); if (UnitIndex > 0) then begin