Hi all,

I am experiencing this error: The instruction at '' referenced memory at ''. The memory could not be read. What I want to do is possibly Catch that error and execute a Go To Statement so that it will skip that part of the code altogether.

I do not know what parameter to put in the catch(<?>) block. Can anyone help me with this? Is it also possible if I want the code part where I want to GoTo is located in a different class/file?


Some additional information: This error occurs when I try to read an XML node attribute but is not present. Here is the part of the code where I think it causes this error.

VARIANT GetAttribute(string attribute, IXMLDOMNamedNodeMap* pNodeMap)
{
VARIANT varAtt;

IXMLDOMNode* pAtt = NULL;

_bstr_t tempb = attribute.c_str();
//Process varSource first to determine if to use WMI or TSVar
BSTR bstrAtt = tempb.copy();
pNodeMap->getNamedItem(bstrAtt,&pAtt);
pAtt->get_nodeValue(&varAtt);

SAFE_RELEASE(pAtt);

return varAtt;
}



Thank you!