FIX: Access violation on attempt to edit directory in file search results (fixes #949)

(cherry picked from commit 76a5f8025b)
This commit is contained in:
Alexander Koblov 2023-10-27 19:41:35 +03:00
commit 1be8fa91ee

View file

@ -1926,14 +1926,21 @@ end;
{ TfrmFindDlg.cm_Edit }
procedure TfrmFindDlg.cm_Edit(const Params: array of string);
var
FileName: String;
begin
if pgcSearch.ActivePage = tsResults then
if lsFoundedFiles.ItemIndex <> -1 then
begin
if (ObjectType(lsFoundedFiles.ItemIndex) = cbChecked) then
msgError(rsMsgErrNotSupported)
else
ShowEditorByGlob(lsFoundedFiles.Items[lsFoundedFiles.ItemIndex]);
else begin
FileName:= lsFoundedFiles.Items[lsFoundedFiles.ItemIndex];
if mbFileExists(FileName) then
ShowEditorByGlob(FileName)
else
msgError(Format(rsMsgFileNotFound, [FileName]));
end;
end;
end;