IDE: fix a crash when opening a file with flag [ofRevert] but no editor yet opened for that file.

git-svn-id: trunk@45550 -
This commit is contained in:
juha 2014-06-16 15:56:06 +00:00
parent 291888ad83
commit baf0ce059f

View File

@ -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