Don't crash if wxWebView::EnableContextMenu() is called too early

Although caller of wxWebViewEdgeImpl::GetSettings() check if it returns
NULL and handle it gracefully, this function itself can crash if it's
called too early, i.e. if ICoreWebView2 hasn't been created yet.

Add a check to avoid this and just return NULL settings in this case.

Closes #18840.
This commit is contained in:
Vadim Zeitlin
2020-07-19 13:06:58 +02:00
parent 2e51076159
commit 564676e773

View File

@@ -325,6 +325,9 @@ HRESULT wxWebViewEdgeImpl::OnWebViewCreated(HRESULT result, ICoreWebView2Control
ICoreWebView2Settings* wxWebViewEdgeImpl::GetSettings()
{
if (!m_webView)
return NULL;
ICoreWebView2Settings* settings;
HRESULT hr = m_webView->get_Settings(&settings);
if (FAILED(hr))