comctl32/treeview: Fix possible crash in TVS_SINGELEXPAND helper (Coverity).

This commit is contained in:
Nikolay Sivov 2010-07-28 15:37:10 +04:00 committed by Alexandre Julliard
parent c678bdd718
commit 279677b7d8
2 changed files with 8 additions and 1 deletions

View File

@ -1255,6 +1255,13 @@ static void test_TVS_SINGLEEXPAND(void)
ok(ret, "got %d\n", ret);
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_singleexpand_seq, "singleexpand notifications", FALSE);
/* a workaround for NT4 that sends expanding notification when nothing is about to expand */
ret = SendMessageA(hTree, TVM_DELETEITEM, 0, (LPARAM)hRoot);
ok(ret, "got %d\n", ret);
fill_tree(hTree);
ret = SendMessageA(hTree, TVM_SELECTITEM, TVGN_CARET, 0);
ok(ret, "got %d\n", ret);
DestroyWindow(hTree);
}

View File

@ -3426,7 +3426,7 @@ static void TREEVIEW_SingleExpand(TREEVIEW_INFO *infoPtr,
{
TREEVIEW_ITEM *SelItem;
if ((infoPtr->dwStyle & TVS_SINGLEEXPAND) == 0 || infoPtr->hwndEdit) return;
if ((infoPtr->dwStyle & TVS_SINGLEEXPAND) == 0 || infoPtr->hwndEdit || !item) return;
TREEVIEW_SendTreeviewNotify(infoPtr, TVN_SINGLEEXPAND, TVC_UNKNOWN, TVIF_HANDLE | TVIF_PARAM, item, 0);