comctl32/listview: Exit early on LVM_CREATEDRAGIMAGE if null pointer passed for a point.

This commit is contained in:
Nikolay Sivov 2010-04-20 02:23:28 +04:00 committed by Alexandre Julliard
parent 1b67da3566
commit 7371d0d2fc
2 changed files with 24 additions and 1 deletions

View File

@ -5209,7 +5209,7 @@ static HIMAGELIST LISTVIEW_CreateDragImage(LISTVIEW_INFO *infoPtr, INT iItem, LP
HIMAGELIST dragList = 0;
TRACE("iItem=%d Count=%d\n", iItem, infoPtr->nItemCount);
if (iItem < 0 || iItem >= infoPtr->nItemCount)
if (iItem < 0 || iItem >= infoPtr->nItemCount || !lppt)
return 0;
rcItem.left = LVIR_BOUNDS;

View File

@ -4344,6 +4344,28 @@ static void test_header_notification(void)
DestroyWindow(list);
}
static void test_createdragimage(void)
{
HIMAGELIST himl;
POINT pt;
HWND list;
list = create_listview_control(LVS_ICON);
ok(list != 0, "failed to create listview window\n");
insert_item(list, 0);
/* NULL point */
himl = (HIMAGELIST)SendMessageA(list, LVM_CREATEDRAGIMAGE, 0, 0);
ok(himl == NULL, "got %p\n", himl);
himl = (HIMAGELIST)SendMessageA(list, LVM_CREATEDRAGIMAGE, 0, (LPARAM)&pt);
ok(himl != NULL, "got %p\n", himl);
ImageList_Destroy(himl);
DestroyWindow(list);
}
START_TEST(listview)
{
HMODULE hComctl32;
@ -4406,6 +4428,7 @@ START_TEST(listview)
test_finditem();
test_hover();
test_destroynotify();
test_createdragimage();
if (!load_v6_module(&ctx_cookie, &hCtx))
{