diff --git a/widget/src/windows/nsDataObj.cpp b/widget/src/windows/nsDataObj.cpp index 650af724589..4e04edb4645 100644 --- a/widget/src/windows/nsDataObj.cpp +++ b/widget/src/windows/nsDataObj.cpp @@ -1076,7 +1076,7 @@ HRESULT nsDataObj::GetPreferredDropEffect ( FORMATETC& aFE, STGMEDIUM& aSTG ) //----------------------------------------------------- HRESULT nsDataObj::GetText(const nsACString & aDataFlavor, FORMATETC& aFE, STGMEDIUM& aSTG) { - void* data; + void* data = NULL; PRUint32 len; // if someone asks for text/plain, look up text/unicode instead in the transferable. @@ -1093,6 +1093,9 @@ HRESULT nsDataObj::GetText(const nsACString & aDataFlavor, FORMATETC& aFE, STGME if ( !len ) return ResultFromScode(E_FAIL); nsPrimitiveHelpers::CreateDataFromPrimitive ( flavorStr, genericDataWrapper, &data, len ); + if ( !data ) + return ResultFromScode(E_FAIL); + HGLOBAL hGlobalMemory = NULL; aSTG.tymed = TYMED_HGLOBAL;