From b1f964cbef02c1b3f127fb6a91f089c1cd9d0cf4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 22 Jan 2014 21:56:10 +0000 Subject: huh-huh... still need a check for wrong parameters passed (from borkra, zihrono levraha) git-svn-id: http://svn.miranda-ng.org/main/trunk@7833 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/utils/windowlist.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/utils/windowlist.cpp b/src/modules/utils/windowlist.cpp index 1b3c3493ab..667af0322d 100644 --- a/src/modules/utils/windowlist.cpp +++ b/src/modules/utils/windowlist.cpp @@ -50,6 +50,7 @@ static INT_PTR DestroyWindowList(WPARAM wParam, LPARAM) static INT_PTR AddToWindowList(WPARAM, LPARAM lParam) { + if (lParam == 0) return 1; WINDOWLISTENTRY *pEntry = (WINDOWLISTENTRY*)lParam; TWindowList *pList = (TWindowList*)pEntry->hList; pList->insert(new TWindowListItem(pEntry->hContact, pEntry->hwnd)); @@ -58,6 +59,7 @@ static INT_PTR AddToWindowList(WPARAM, LPARAM lParam) static INT_PTR RemoveFromWindowList(WPARAM wParam, LPARAM lParam) { + if (wParam == 0) return 1; TWindowList &pList = *(TWindowList*)wParam; for (int i = 0; i < pList.getCount(); i++) { if (pList[i].hWnd == (HWND)lParam) { @@ -70,15 +72,17 @@ static INT_PTR RemoveFromWindowList(WPARAM wParam, LPARAM lParam) static INT_PTR FindInWindowList(WPARAM wParam, LPARAM lParam) { + if (wParam == 0) return NULL; TWindowList &pList = *(TWindowList*)wParam; TWindowListItem *p = pList.find((TWindowListItem*)&lParam); - return (p == NULL) ? 0 : (INT_PTR)p->hWnd; + return (p == NULL) ? NULL : (INT_PTR)p->hWnd; } static INT_PTR BroadcastToWindowList(WPARAM wParam, LPARAM lParam) { - MSG *msg = (MSG*)lParam; + if (wParam == 0 || lParam == 0) return NULL; TWindowList &pList = *(TWindowList*)wParam; + MSG *msg = (MSG*)lParam; for (int i = pList.getCount()-1; i >= 0; i--) SendMessage(pList[i].hWnd, msg->message, msg->wParam, msg->lParam); return 0; @@ -86,8 +90,9 @@ static INT_PTR BroadcastToWindowList(WPARAM wParam, LPARAM lParam) static INT_PTR BroadcastToWindowListAsync(WPARAM wParam, LPARAM lParam) { - MSG *msg = (MSG*)lParam; + if (wParam == 0 || lParam == 0) return NULL; TWindowList &pList = *(TWindowList*)wParam; + MSG *msg = (MSG*)lParam; for (int i = pList.getCount()-1; i >= 0; i--) PostMessage(pList[i].hWnd, msg->message, msg->wParam, msg->lParam); return 0; -- cgit v1.2.3