mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 05:16:48 +02:00
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:
parent
291888ad83
commit
baf0ce059f
@ -1349,7 +1349,7 @@ function TLazSourceFileManager.OpenEditorFile(AFileName: string; PageIndex,
|
|||||||
var
|
var
|
||||||
UnitIndex: integer;
|
UnitIndex: integer;
|
||||||
UnknownFile, Handled: boolean;
|
UnknownFile, Handled: boolean;
|
||||||
NewUnitInfo:TUnitInfo;
|
NewUnitInfo: TUnitInfo;
|
||||||
NewBuf: TCodeBuffer;
|
NewBuf: TCodeBuffer;
|
||||||
FilenameNoPath: String;
|
FilenameNoPath: String;
|
||||||
LoadBufferFlags: TLoadBufferFlags;
|
LoadBufferFlags: TLoadBufferFlags;
|
||||||
@ -1427,7 +1427,9 @@ begin
|
|||||||
UseWindowID := False;
|
UseWindowID := False;
|
||||||
assert((WindowIndex >= 0) and (WindowIndex < SourceEditorManager.SourceWindowCount), 'WindowIndex for revert');
|
assert((WindowIndex >= 0) and (WindowIndex < SourceEditorManager.SourceWindowCount), 'WindowIndex for revert');
|
||||||
AFilename := SourceEditorManager.SourceEditorsByPage[WindowIndex, PageIndex].FileName;
|
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);
|
UnitIndex:=Project1.IndexOfFilename(AFilename);
|
||||||
if (UnitIndex > 0) then begin
|
if (UnitIndex > 0) then begin
|
||||||
|
Loading…
Reference in New Issue
Block a user