don't try to extract characters from an empty string

This commit is contained in:
scc%mozilla.org 2000-06-11 07:23:58 +00:00
parent 079914eaf0
commit 09789effd8

View File

@ -78,18 +78,20 @@ nsRDFParserUtils::EntityToUnicode(const char* buf)
void
nsRDFParserUtils::StripAndConvert(nsString& aResult)
{
// Strip quotes if present
PRUnichar first = aResult.First();
if ((first == '"') || (first == '\'')) {
if (aResult.Last() == first) {
aResult.Cut(0, 1);
PRInt32 pos = aResult.Length() - 1;
if (pos >= 0) {
aResult.Cut(pos, 1);
}
} else {
// Mismatched quotes - leave them in
}
if ( !aResult.IsEmpty() ) {
// Strip quotes if present
PRUnichar first = aResult.First();
if ((first == '"') || (first == '\'')) {
if (aResult.Last() == first) {
aResult.Cut(0, 1);
PRInt32 pos = aResult.Length() - 1;
if (pos >= 0) {
aResult.Cut(pos, 1);
}
} else {
// Mismatched quotes - leave them in
}
}
}
// Reduce any entities