Check return value of curl_easy_init()
Normally it is not supposed to fail, but still try not to crash if it does.
This commit is contained in:
@@ -162,6 +162,12 @@ wxWebRequestCURL::wxWebRequestCURL(wxWebSession & session,
|
|||||||
m_headerList = NULL;
|
m_headerList = NULL;
|
||||||
|
|
||||||
m_handle = curl_easy_init();
|
m_handle = curl_easy_init();
|
||||||
|
if ( !m_handle )
|
||||||
|
{
|
||||||
|
wxStrlcpy(m_errorBuffer, "libcurl initialization failed", CURL_ERROR_SIZE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Set error buffer to get more detailed CURL status
|
// Set error buffer to get more detailed CURL status
|
||||||
m_errorBuffer[0] = '\0';
|
m_errorBuffer[0] = '\0';
|
||||||
curl_easy_setopt(m_handle, CURLOPT_ERRORBUFFER, m_errorBuffer);
|
curl_easy_setopt(m_handle, CURLOPT_ERRORBUFFER, m_errorBuffer);
|
||||||
|
Reference in New Issue
Block a user