Bug 336959. Exit properly if we get OOM. patch by Theppitak Karoonboonyanan, r+sr=roc,a=damon

This commit is contained in:
roc+@cs.cmu.edu 2007-09-03 20:58:52 -07:00
parent b8b95b63ba
commit d898a67ade

View File

@ -49,14 +49,11 @@ NS_GetComplexLineBreaks(const PRUnichar* aText, PRUint32 aLength,
{
NS_ASSERTION(aText, "aText shouldn't be null");
memset(aBreakBefore, PR_FALSE, aLength * sizeof(PRPackedBool));
nsAutoTArray<PangoLogAttr, 2000> attrBuffer;
if (!attrBuffer.AppendElements(aLength + 1))
{
// out of memory, behave as if there were no complex line breaker
for (PRUint32 i = 0; i < aLength; ++i) {
aBreakBefore[i] = PR_FALSE;
}
}
return;
NS_ConvertUTF16toUTF8 aUTF8(aText, aLength);