check for NULL when attaching to foreground window

Should fix Issue #66
thanks to joerg.bornemann for the patch
This commit is contained in:
syed.amer@gilani.eu 2010-02-24 14:37:41 +00:00
parent f96c2b3572
commit 25d8110ed2
1 changed files with 3 additions and 0 deletions

View File

@ -156,6 +156,9 @@ attachThreadToForeground()
// already in the right thread.
if (g_hookThread != 0) {
HWND window = GetForegroundWindow();
if (window == NULL)
return false;
DWORD threadID = GetWindowThreadProcessId(window, NULL);
// skip if no change
if (g_attachedThread != threadID) {