From 292d8429ab39e3fa9901000b149b8779e550b6af Mon Sep 17 00:00:00 2001 From: Adam Gundy Date: Thu, 6 Mar 2003 22:41:59 +0000 Subject: [PATCH] TREEVIEW_UpdateScrollBars() now copes with an empty tree. --- dlls/comctl32/treeview.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index 3bf77aaf96c..57d98c7829e 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c @@ -2690,14 +2690,23 @@ TREEVIEW_UpdateScrollBars(TREEVIEW_INFO *infoPtr) if (vert) { si.nPage = TREEVIEW_GetVisibleCount(infoPtr); - si.nPos = infoPtr->firstVisible->visibleOrder; - si.nMax = infoPtr->maxVisibleOrder - 1; + if ( si.nPage ) + { + si.nPos = infoPtr->firstVisible->visibleOrder; + si.nMax = infoPtr->maxVisibleOrder - 1; - SetScrollInfo(hwnd, SB_VERT, &si, TRUE); + SetScrollInfo(hwnd, SB_VERT, &si, TRUE); - if (!(infoPtr->uInternalStatus & TV_VSCROLL)) - ShowScrollBar(hwnd, SB_VERT, TRUE); - infoPtr->uInternalStatus |= TV_VSCROLL; + if (!(infoPtr->uInternalStatus & TV_VSCROLL)) + ShowScrollBar(hwnd, SB_VERT, TRUE); + infoPtr->uInternalStatus |= TV_VSCROLL; + } + else + { + if (infoPtr->uInternalStatus & TV_VSCROLL) + ShowScrollBar(hwnd, SB_VERT, FALSE); + infoPtr->uInternalStatus &= ~TV_VSCROLL; + } } else { -- 2.11.4.GIT