FIX: Crash if Enter pressed in QuickSearch when file list is empty.

This commit is contained in:
cobines 2011-10-03 13:33:50 +00:00
commit 5bbbecd928
2 changed files with 23 additions and 23 deletions

View file

@ -2006,8 +2006,7 @@ begin
// If on a file/directory then choose it.
if (Point.Y >= dgPanel.GetHeaderHeight) and
(Point.Y < dgPanel.GridHeight) and
(not IsEmpty) then
(Point.Y < dgPanel.GridHeight) then
begin
ChooseFile(GetActiveDisplayFile);
end;
@ -2177,8 +2176,7 @@ begin
VK_RIGHT:
if (Shift = []) and gLynxLike then
begin
if Assigned(GetActiveDisplayFile) then
ChooseFile(GetActiveDisplayFile, True);
ChooseFile(GetActiveDisplayFile, True);
Key := 0;
end;
@ -3249,8 +3247,7 @@ end;
procedure TColumnsFileView.cm_Open(param: string='');
begin
if Assigned(GetActiveDisplayFile) then
ChooseFile(GetActiveDisplayFile);
ChooseFile(GetActiveDisplayFile);
end;
procedure TColumnsFileView.cm_CountDirContent(param: string='');

View file

@ -726,23 +726,26 @@ procedure TFileView.ChooseFile(const AFile: TDisplayFile; FolderMode: Boolean =
var
FSFile: TFile;
begin
FSFile := AFile.FSFile.Clone;
try
if FSFile.Name = '..' then
ChangePathToParent(True)
else if FSFile.IsLinkToDirectory then
ChooseSymbolicLink(Self, FSFile)
else if FSFile.IsDirectory then
ChangePathToChild(FSFile)
else if not FolderMode then
try
uFileSourceUtil.ChooseFile(Self, FSFile);
except
on e: Exception do
MessageDlg('Error', e.Message, mtError, [mbOK], 0);
end;
finally
FSFile.Free;
if Assigned(AFile) then
begin
FSFile := AFile.FSFile.Clone;
try
if FSFile.Name = '..' then
ChangePathToParent(True)
else if FSFile.IsLinkToDirectory then
ChooseSymbolicLink(Self, FSFile)
else if FSFile.IsDirectory then
ChangePathToChild(FSFile)
else if not FolderMode then
try
uFileSourceUtil.ChooseFile(Self, FSFile);
except
on e: Exception do
MessageDlg('Error', e.Message, mtError, [mbOK], 0);
end;
finally
FSFile.Free;
end;
end;
end;