Certain functions in my program get a bad pointer with a low probability.
The pointer is the CComPtr <IHTMLDocument2> m_htmldocument2 variable.
Moving the m_htmldocument2 variable to a local variable causes an access violation error if m_htmldocument2 is not a valid value.
I did not have a way to check if m_htmldocument2 was a valid value, and tried to process it as __try __except, but I could not do it because there was a destructor.
Is there a safe way to move to a local variables?
 
    