More restrictive checks, so DIALOG_IsAccelerator don't loop
endlessly.

diff --git a/windows/dialog.c b/windows/dialog.c
index 0a908ce..0786061 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -1183,7 +1183,7 @@
 	    {
 	        hwndNext = GetWindow( hwndControl, GW_HWNDNEXT );
 	    }
-	    while (!hwndNext)
+	    while (!hwndNext && hwndControl)
 	    {
 		hwndControl = GetParent( hwndControl );
 		if (hwndControl == hwndDlg)
@@ -1201,7 +1201,7 @@
 	    }
             hwndControl = hwndNext;
         }
-        while (hwndControl != hwnd);
+        while (hwndControl && (hwndControl != hwnd));
     }
     return RetVal;
 }