mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-14 18:12:05 +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;
|
function TMainForm.ActiveQueryTab: TQueryTab;
|
||||||
|
var
|
||||||
|
idx: Integer;
|
||||||
begin
|
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;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -9396,8 +9402,10 @@ end;
|
|||||||
|
|
||||||
function TMainForm.ActiveGrid: TVirtualStringTree;
|
function TMainForm.ActiveGrid: TVirtualStringTree;
|
||||||
begin
|
begin
|
||||||
|
Result := nil;
|
||||||
if PageControlMain.ActivePage = tabData then Result := DataGrid
|
if PageControlMain.ActivePage = tabData then Result := DataGrid
|
||||||
else Result := ActiveQueryTab.Grid;
|
else if ActiveQueryTab <> nil then
|
||||||
|
Result := ActiveQueryTab.Grid;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user