X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e5f9b4ae2df3a334ede364f0c8131f7d7667b66f..96c9640205933ad0673d5af2c96af0816c50160c:/src/msw/webview_ie.cpp diff --git a/src/msw/webview_ie.cpp b/src/msw/webview_ie.cpp index 2bdae652c0..c42c1a00ea 100644 --- a/src/msw/webview_ie.cpp +++ b/src/msw/webview_ie.cpp @@ -874,12 +874,13 @@ void wxWebViewIE::ExecCommand(wxString command) IHTMLDocument2* wxWebViewIE::GetDocument() const { - IDispatch* dispatch; + IDispatch* dispatch = NULL; HRESULT result = m_webBrowser->get_Document(&dispatch); - if(SUCCEEDED(result)) + if(dispatch && SUCCEEDED(result)) { IHTMLDocument2* document; dispatch->QueryInterface(IID_IHTMLDocument2, (void**)&document); + dispatch->Release(); //document is set to null automatically if the interface isn't supported return document; }