mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-14 01:56:36 +08:00
It's legal for ActiveGrid() to return nil, as there are tabs without a data- or querygrid. Fix relevant functions so they don't barf with a "List index out of bounds" violation. Fixes issue #1320
This commit is contained in:
@ -9368,8 +9368,14 @@ end;
|
||||
|
||||
|
||||
function TMainForm.ActiveQueryTab: TQueryTab;
|
||||
var
|
||||
idx: Integer;
|
||||
begin
|
||||
Result := QueryTabs[PageControlMain.ActivePageIndex-tabQuery.PageIndex] as TQueryTab;
|
||||
idx := PageControlMain.ActivePageIndex-tabQuery.PageIndex;
|
||||
if (idx >= 0) and (idx < QueryTabs.Count) then
|
||||
Result := QueryTabs[idx] as TQueryTab
|
||||
else
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
|
||||
@ -9396,8 +9402,10 @@ end;
|
||||
|
||||
function TMainForm.ActiveGrid: TVirtualStringTree;
|
||||
begin
|
||||
Result := nil;
|
||||
if PageControlMain.ActivePage = tabData then Result := DataGrid
|
||||
else Result := ActiveQueryTab.Grid;
|
||||
else if ActiveQueryTab <> nil then
|
||||
Result := ActiveQueryTab.Grid;
|
||||
end;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user