Attempt to fix out-of-range error in TMainForm.tabsetQueryMouseMove

This commit is contained in:
Ansgar Becker
2020-12-14 18:24:30 +01:00
parent 8f826e814d
commit f95fa2759a

View File

@ -7874,6 +7874,7 @@ var
Tabs: TTabSet; Tabs: TTabSet;
Rect: TRect; Rect: TRect;
Org: TPoint; Org: TPoint;
QueryTab: TQueryTab;
ResultTab: TResultTab; ResultTab: TResultTab;
HintSQL: TStringList; HintSQL: TStringList;
begin begin
@ -7889,12 +7890,15 @@ begin
// Check if user wants these balloon hints // Check if user wants these balloon hints
if not AppSettings.ReadBool(asHintsOnResultTabs) then if not AppSettings.ReadBool(asHintsOnResultTabs) then
Exit; Exit;
QueryTab := ActiveQueryTab;
if idx >= QueryTab.ResultTabs.Count then
Exit;
// Make SQL readable for the tooltip balloon. WrapText() is unsuitable here. // Make SQL readable for the tooltip balloon. WrapText() is unsuitable here.
// See issue #2014 // See issue #2014
// Also, wee need to work around the awful looking balloon text: // Also, wee need to work around the awful looking balloon text:
// http://qc.embarcadero.com/wc/qcmain.aspx?d=73771 // http://qc.embarcadero.com/wc/qcmain.aspx?d=73771
ResultTab := ActiveQueryTab.ResultTabs[idx]; ResultTab := QueryTab.ResultTabs[idx];
HintSQL := TStringList.Create; HintSQL := TStringList.Create;
HintSQL.Text := Trim(ResultTab.Results.SQL); HintSQL.Text := Trim(ResultTab.Results.SQL);
for i:=0 to HintSQL.Count-1 do begin for i:=0 to HintSQL.Count-1 do begin