Should check NULL return on CHttpConnection::OpenRequest() and CInternetSession::GetHttpConnection()

drjackool 956 Reputation points
2021-09-01T08:30:14.477+00:00

Hi
Should check NULL return on CHttpConnection::OpenRequest() and CInternetSession::GetHttpConnection()?! because these functions throw an exception on fail and I have to use try-catch block.

try
{
pConnection = pSession->GetHttpConnection(...);
}
catch (CInternetException* e)
{
e->Delete();
        return;
}

if (pConnection) // can remove this if; is it safe?
{
}

thanks

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,751 questions
0 comments No comments
{count} votes

0 additional answers

Sort by: Most helpful