nsXMLContentSerializer::AppendTextData() causes assertion in nsDependentString::Rebind()

bug 119335 r=akkana sr=jst a=asa patch=tmutreja@netscape.com
This commit is contained in:
badami%netscape.com 2002-03-13 06:20:15 +00:00
parent 6edffd5f4d
commit 27d5bba4cc

View File

@ -104,11 +104,13 @@ nsXMLContentSerializer::AppendTextData(nsIDOMNode* aNode,
content->GetText(&frag);
if (frag) {
PRInt32 length = ((aEndOffset == -1) ? frag->GetLength() : aEndOffset) - aStartOffset;
PRInt32 endoffset = (aEndOffset == -1) ? frag->GetLength() : aEndOffset;
PRInt32 length = endoffset - aStartOffset;
NS_ASSERTION(aStartOffset >= 0, "Negative start offset for text fragment!");
NS_ASSERTION(aStartOffset <= endoffset, "A start offset is beyond the end of the text fragment!");
if (length <= 0) {
NS_ASSERTION(aStartOffset == 0,
"a start offset is beyond the end of the text fragment!");
return NS_OK; // XXX Zero is a legal value, maybe non-zero values should
// be an error.
}