LCL: Prevent a crash in Coolbar when clicking a Grabber in an empty band.

git-svn-id: branches/fixes_2_0@62852 -
This commit is contained in:
mattias 2020-04-02 11:21:27 +00:00
parent 851dc814ae
commit 3f95c60f40

View File

@ -1002,7 +1002,7 @@ begin
end; end;
procedure TCustomCoolBar.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure TCustomCoolBar.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var aBand, w, h: Integer; var aBand, w, h, offs: Integer;
newRowBelow, needRecalc, needBandMaximize, aGrabber: Boolean; newRowBelow, needRecalc, needBandMaximize, aGrabber: Boolean;
begin begin
inherited MouseUp(Button, Shift, X, Y); inherited MouseUp(Button, Shift, X, Y);
@ -1014,14 +1014,16 @@ begin
end; end;
if needBandMaximize then begin if needBandMaximize then begin
MouseToBandPos(X, Y, aBand, aGrabber); MouseToBandPos(X, Y, aBand, aGrabber);
if aGrabber then begin if aGrabber and Assigned(FVisiBands[aBand].control) then begin
w:=0; w:=0;
h:=0; h:=0;
FVisiBands[aBand].control.GetPreferredSize(w,h); FVisiBands[aBand].control.GetPreferredSize(w,h);
offs:=FVisiBands[aBand].CalcControlLeft
+FVisiBands[aBand].cDivider + HorizontalSpacing;
if vertical then if vertical then
FVisiBands[aBand].width:=FVisiBands[aBand].CalcControlLeft+h+HorizontalSpacing+FVisiBands[aBand].cDivider FVisiBands[aBand].width:=offs+h
else else
FVisiBands[aBand].width:=FVisiBands[aBand].CalcControlLeft+w+HorizontalSpacing+FVisiBands[aBand].cDivider; FVisiBands[aBand].width:=offs+w;
FDraggedBandIndex:=-1; FDraggedBandIndex:=-1;
end; end;
end; end;