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:
@@ -325,6 +325,9 @@ HRESULT wxWebViewEdgeImpl::OnWebViewCreated(HRESULT result, ICoreWebView2Control
|
|||||||
|
|
||||||
ICoreWebView2Settings* wxWebViewEdgeImpl::GetSettings()
|
ICoreWebView2Settings* wxWebViewEdgeImpl::GetSettings()
|
||||||
{
|
{
|
||||||
|
if (!m_webView)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
ICoreWebView2Settings* settings;
|
ICoreWebView2Settings* settings;
|
||||||
HRESULT hr = m_webView->get_Settings(&settings);
|
HRESULT hr = m_webView->get_Settings(&settings);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
|
Reference in New Issue
Block a user