don't try to extract characters from an empty string

This commit is contained in:
scc%mozilla.org 2000-06-11 09:14:09 +00:00
Родитель e15e22ba38
Коммит 7d08825730
2 изменённых файлов: 26 добавлений и 22 удалений

Просмотреть файл

@ -611,20 +611,22 @@ HTMLContentSink::GetAttributeValueAt(const nsIParserNode& aNode,
aResult.Append(value);
aResult.Trim("\b\r\t\n",PR_TRUE,PR_TRUE,PR_TRUE);
// 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);
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
}
} else {
// Mismatched quotes - leave them in
}
ReduceEntities(aResult);
}
ReduceEntities(aResult);
}
nsresult

Просмотреть файл

@ -611,20 +611,22 @@ HTMLContentSink::GetAttributeValueAt(const nsIParserNode& aNode,
aResult.Append(value);
aResult.Trim("\b\r\t\n",PR_TRUE,PR_TRUE,PR_TRUE);
// 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);
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
}
} else {
// Mismatched quotes - leave them in
}
ReduceEntities(aResult);
}
ReduceEntities(aResult);
}
nsresult