mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 00:05:36 +00:00
Bug 328755 - Fix the ConvertAndWrite crash. r=bz
This commit is contained in:
parent
ee57f16151
commit
56f7c1ed2b
@ -559,6 +559,12 @@ ConvertAndWrite(const nsAString& aString,
|
|||||||
startCharLength = charLength;
|
startCharLength = charLength;
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
if (!charLength) {
|
||||||
|
// Nothing to write. Besides, a length 0 string has an immutable buffer, so
|
||||||
|
// attempts to null-terminate it will crash.
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
nsAutoCString charXferString;
|
nsAutoCString charXferString;
|
||||||
if (!charXferString.SetLength(charLength, fallible_t()))
|
if (!charXferString.SetLength(charLength, fallible_t()))
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
Loading…
Reference in New Issue
Block a user