Skip to content

Commit 76a4d19

Browse files
authored
Fix Prefast C6387 on SimpleIslandApp.cpp (#332)
1 parent a3393c0 commit 76a4d19

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

Samples/Islands/cpp-win32-unpackaged/SimpleIslandApp.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,16 @@ void MyRegisterClass(HINSTANCE hInstance, const wchar_t* szWindowClass)
192192
//
193193
HWND InitInstance(HINSTANCE /*hInstance*/, int nCmdShow, const wchar_t* szTitle, const wchar_t* szWindowClass)
194194
{
195-
HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
196-
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, ::GetModuleHandle(NULL), nullptr);
197-
winrt::check_bool(hWnd != NULL);
198-
199-
ShowWindow(hWnd, nCmdShow);
200-
UpdateWindow(hWnd);
201-
return hWnd;
195+
HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
196+
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, ::GetModuleHandle(NULL), nullptr);
197+
winrt::check_bool(hWnd != NULL);
198+
if(!hWnd)
199+
{
200+
throw E_HANDLE;
201+
}
202+
ShowWindow(hWnd, nCmdShow);
203+
UpdateWindow(hWnd);
204+
return hWnd;
202205
}
203206

204207
//

0 commit comments

Comments
 (0)