Skip to content

Commit 8b33dcc

Browse files
committed
Fix invoking unset nativehandle callbacks
1 parent 7de91c0 commit 8b33dcc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Release/include/cpprest/http_client.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ class http_client_config
8787
#if !defined(__cplusplus_winrt)
8888
, m_validate_certificates(true)
8989
#endif
90-
, m_set_user_nativehandle_options([](native_handle)->void{})
9190
#if !defined(_WIN32) && !defined(__cplusplus_winrt) || defined(CPPREST_FORCE_HTTP_CLIENT_ASIO)
9291
, m_tlsext_sni_enabled(true)
9392
#endif
@@ -332,7 +331,8 @@ class http_client_config
332331
/// <param name="handle">A internal implementation handle.</param>
333332
void _invoke_nativesessionhandle_options(native_handle handle) const
334333
{
335-
m_set_user_nativesessionhandle_options(handle);
334+
if (m_set_user_nativesessionhandle_options)
335+
m_set_user_nativesessionhandle_options(handle);
336336
}
337337

338338
/// <summary>
@@ -358,7 +358,8 @@ class http_client_config
358358
/// <param name="handle">A internal implementation handle.</param>
359359
void invoke_nativehandle_options(native_handle handle) const
360360
{
361-
m_set_user_nativehandle_options(handle);
361+
if (m_set_user_nativehandle_options)
362+
m_set_user_nativehandle_options(handle);
362363
}
363364

364365
#if !defined(_WIN32) && !defined(__cplusplus_winrt) || defined(CPPREST_FORCE_HTTP_CLIENT_ASIO)

0 commit comments

Comments
 (0)