I am working on code that was compiled under VC++ version 6 and moved to VC++ 2008. I am getting a crash from the COlePasteSpecialDialog.AddStandardFormats().

Does anyone know the solution to this? The AddStandardFormats() loks like this:

{
// Note: only need to add Embedded Object because Embed Source is
// automatically recognized by the paste special dialog implementation.
ASSERT(_oleData.cfEmbeddedObject != NULL);
AddFormat(_oleData.cfEmbeddedObject, TYMED_ISTORAGE, AFX_IDS_EMBED_FORMAT,
TRUE, FALSE);

// add link source if requested
if (bEnableLink)
{
ASSERT(_oleData.cfLinkSource != NULL);
AddFormat(_oleData.cfLinkSource, TYMED_ISTREAM, AFX_IDS_LINKSOURCE_FORMAT,
TRUE, TRUE);
}

// add formats that can be used for 'static' items
AddFormat(CF_METAFILEPICT, TYMED_MFPICT, AFX_IDS_METAFILE_FORMAT,
FALSE, FALSE);
AddFormat(CF_DIB, TYMED_HGLOBAL, AFX_IDS_DIB_FORMAT, FALSE, FALSE);
AddFormat(CF_BITMAP, TYMED_GDI, AFX_IDS_BITMAP_FORMAT, FALSE, FALSE);
}

In one of the AddFormats calls ...

...
LPTSTR lpszResult = _tcschr(szFormat, '\n');
ENSURE(lpszResult != NULL); // must contain a newline
*lpszResult = '\0';
++lpszResult; // one char past newline
...

The lpszResult is NULL and thus the system crashes when the *lpszReslt = '\0' is executed. I do get an exception from the ENSURE()... but on the old compiler this AddStandardFormats() worked...anyone have an suggestion? Know how to resolve?