diff --git a/mozilla/string/obsolete/nsString.cpp b/mozilla/string/obsolete/nsString.cpp index 6a0191c1fd8..067b7073df4 100644 --- a/mozilla/string/obsolete/nsString.cpp +++ b/mozilla/string/obsolete/nsString.cpp @@ -1862,6 +1862,11 @@ void nsCString::DebugDump(void) const { void NS_ConvertUCS2toUTF8::Init( const PRUnichar* aString, PRUint32 aLength ) { + // Handle null string by just leaving us as a brand-new + // uninitialized nsCAutoString. + if (! aString) + return; + // Caculate how many bytes we need const PRUnichar* p; PRInt32 count, utf8len; diff --git a/mozilla/xpcom/ds/nsString.cpp b/mozilla/xpcom/ds/nsString.cpp index 6a0191c1fd8..067b7073df4 100644 --- a/mozilla/xpcom/ds/nsString.cpp +++ b/mozilla/xpcom/ds/nsString.cpp @@ -1862,6 +1862,11 @@ void nsCString::DebugDump(void) const { void NS_ConvertUCS2toUTF8::Init( const PRUnichar* aString, PRUint32 aLength ) { + // Handle null string by just leaving us as a brand-new + // uninitialized nsCAutoString. + if (! aString) + return; + // Caculate how many bytes we need const PRUnichar* p; PRInt32 count, utf8len; diff --git a/mozilla/xpcom/string/obsolete/nsString.cpp b/mozilla/xpcom/string/obsolete/nsString.cpp index 6a0191c1fd8..067b7073df4 100644 --- a/mozilla/xpcom/string/obsolete/nsString.cpp +++ b/mozilla/xpcom/string/obsolete/nsString.cpp @@ -1862,6 +1862,11 @@ void nsCString::DebugDump(void) const { void NS_ConvertUCS2toUTF8::Init( const PRUnichar* aString, PRUint32 aLength ) { + // Handle null string by just leaving us as a brand-new + // uninitialized nsCAutoString. + if (! aString) + return; + // Caculate how many bytes we need const PRUnichar* p; PRInt32 count, utf8len;