Commit ff951dc8 authored by Zhao Yi's avatar Zhao Yi Committed by Alexandre Julliard

comctl32/syslink: Check item type before increasing link ID in SYSLINK_LinkAtPt().

Signed-off-by: 's avatarZhaoyi <zhaoyi@uniontech.com>
parent 53fd667e
......@@ -1320,16 +1320,18 @@ static PDOC_ITEM SYSLINK_LinkAtPt (const SYSLINK_INFO *infoPtr, const POINT *pt,
LIST_FOR_EACH_ENTRY(Current, &infoPtr->Items, DOC_ITEM, entry)
{
if((Current->Type == slLink) && SYSLINK_PtInDocItem(Current, *pt) &&
(!MustBeEnabled || (Current->u.Link.state & LIS_ENABLED)))
if(Current->Type == slLink)
{
if(LinkId != NULL)
if(SYSLINK_PtInDocItem(Current, *pt) && (!MustBeEnabled || (Current->u.Link.state & LIS_ENABLED)))
{
*LinkId = id;
if(LinkId != NULL)
{
*LinkId = id;
}
return Current;
}
return Current;
id++;
}
id++;
}
return NULL;
......
......@@ -264,13 +264,13 @@ static void test_link_id(void)
g_link_id = 0;
SendMessageA(hwnd, WM_LBUTTONDOWN, 1, MAKELPARAM(50, 10));
SendMessageA(hwnd, WM_LBUTTONUP, 0, MAKELPARAM(50, 10));
todo_wine ok(g_link_id == 0, "Got unexpected link id %d.\n", g_link_id);
ok(g_link_id == 0, "Got unexpected link id %d.\n", g_link_id);
/* test link2 at (25, 25) */
g_link_id = 0;
SendMessageA(hwnd, WM_LBUTTONDOWN, 1, MAKELPARAM(25, 25));
SendMessageA(hwnd, WM_LBUTTONUP, 0, MAKELPARAM(25, 25));
todo_wine ok(g_link_id == 1, "Got unexpected link id %d.\n", g_link_id);
ok(g_link_id == 1, "Got unexpected link id %d.\n", g_link_id);
DestroyWindow(hwnd);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment