Skip to content

Commit e5c73e9

Browse files
committed
Added assign check on the scrollbars, as this seems not to be guaranteed by calling InitializeScrollBars()
1 parent 258975c commit e5c73e9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Source/VirtualTrees.StyleHooks.pas

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ procedure TVclStyleScrollBarsHook.CalcScrollBarsRect();
168168
BarInfo: TScrollBarInfo;
169169
Ret: BOOL;
170170
begin
171+
if not Assigned(VertScrollWnd) then // Might happen, when FInitingScrollBars is set, so InitScrollBars did not yet initialize the members
172+
Exit;
173+
171174
BarInfo.cbSize := SizeOf(BarInfo);
172175
Ret := GetScrollBarInfo(Handle, Integer(OBJID_VSCROLL), BarInfo);
173176
VertScrollWnd.Visible := (seBorder in Control.StyleElements) and Ret and (not (STATE_SYSTEM_INVISIBLE and BarInfo.rgstate[0] <> 0));
@@ -179,6 +182,9 @@ procedure TVclStyleScrollBarsHook.CalcScrollBarsRect();
179182
BarInfo: TScrollBarInfo;
180183
Ret: BOOL;
181184
begin
185+
if not Assigned(HorzScrollWnd) then // Might happen, when FInitingScrollBars is set, so InitScrollBars did not yet initialize the members
186+
Exit;
187+
182188
BarInfo.cbSize := SizeOf(BarInfo);
183189
Ret := GetScrollBarInfo(Handle, Integer(OBJID_HSCROLL), BarInfo);
184190
HorzScrollWnd.Visible := (seBorder in Control.StyleElements) and Ret and (not (STATE_SYSTEM_INVISIBLE and BarInfo.rgstate[0] <> 0));

0 commit comments

Comments
 (0)