Check null pointer before fclose (#586)

* Check null pointer before fclose, because fclose(NULL) will lead to undefined behavior

* Update main.cpp

Cast to one code style

* Update main.cpp

Remove redundant ==
This commit is contained in:
Artem Chernousov 2019-05-10 21:02:24 +03:00 committed by Michael Niksa
parent cafe59d73c
commit 99555ef9e9

View file

@ -70,7 +70,10 @@ int __cdecl wmain(int argc, wchar_t* argv[])
fGotChar = GetChar(&wch);
}
fclose(hFile);
if (hFile)
{
fclose(hFile);
}
wprintf(L"Done.\r\n");
}