LCL: Prevent an occational range error in ShellListView. Remove useless checks.

This commit is contained in:
Juha 2022-03-04 01:40:43 +02:00
parent e4d6aa9125
commit 82b9902b12
2 changed files with 4 additions and 4 deletions

View File

@ -188,10 +188,10 @@ var
W: TWidth; W: TWidth;
begin begin
W := AValue; W := AValue;
if (MinWidth > 0) and (W < MinWidth) then if W < MinWidth then
W := MinWidth W := MinWidth
else else
if (MaxWidth > 0) and (W > MaxWidth) then if W > MaxWidth then
W := MaxWidth; W := MaxWidth;
if Width = W then Exit; // compare with Width instead of FWidth - FWidth is not updated from the WS automatically if Width = W then Exit; // compare with Width instead of FWidth - FWidth is not updated from the WS automatically
FWidth := W; FWidth := W;

View File

@ -22,7 +22,7 @@ unit ShellCtrls;
interface interface
uses uses
Classes, SysUtils, Laz_AVL_Tree, Classes, SysUtils, Math, Laz_AVL_Tree,
// LCL // LCL
Forms, Graphics, ComCtrls, LCLProc, LCLType, LCLStrConsts, Types, Forms, Graphics, ComCtrls, LCLProc, LCLType, LCLStrConsts, Types,
// LazUtils // LazUtils
@ -1601,7 +1601,7 @@ begin
Column[0].Width := (70 * iWidth) div 100; Column[0].Width := (70 * iWidth) div 100;
Column[1].Width := (15 * iWidth) div 100; Column[1].Width := (15 * iWidth) div 100;
end; end;
Column[2].Width := iWidth - Column[0].Width - Column[1].Width; Column[2].Width := Max(0, iWidth - Column[0].Width - Column[1].Width);
finally finally
EndUpdate; EndUpdate;
end; end;