fixed a potential crash in case of empty documents

This commit is contained in:
rickg%netscape.com 1998-08-05 03:16:51 +00:00
Родитель 0349dc3a1b
Коммит 7bfa5d371b
2 изменённых файлов: 24 добавлений и 24 удалений

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

@ -381,19 +381,19 @@ PRInt32 nsParser::DidBuildModel(PRInt32 anErrorCode) {
PRInt32 result=anErrorCode;
if(mParserContext->mDTD) {
result=mParserContext->mDTD->DidBuildModel(anErrorCode,PRBool(0==mParserContext->mPrevContext));
}
//Now it's time to recycle our used tokens.
//The current context has a deque full of them,
//and the ones that preceed currentpos are no
//longer needed. Let's recycle them.
nsDeque& theDeque=mParserContext->mTokenDeque;
nsITokenRecycler* theRecycler=mParserContext->mDTD->GetTokenRecycler();
if(theRecycler) {
CToken* theToken=(CToken*)theDeque.Pop();
while(theToken) {
theRecycler->RecycleToken(theToken);
theToken=(CToken*)theDeque.Pop();
//Now it's time to recycle our used tokens.
//The current context has a deque full of them,
//and the ones that preceed currentpos are no
//longer needed. Let's recycle them.
nsDeque& theDeque=mParserContext->mTokenDeque;
nsITokenRecycler* theRecycler=mParserContext->mDTD->GetTokenRecycler();
if(theRecycler) {
CToken* theToken=(CToken*)theDeque.Pop();
while(theToken) {
theRecycler->RecycleToken(theToken);
theToken=(CToken*)theDeque.Pop();
}
}
}

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

@ -381,19 +381,19 @@ PRInt32 nsParser::DidBuildModel(PRInt32 anErrorCode) {
PRInt32 result=anErrorCode;
if(mParserContext->mDTD) {
result=mParserContext->mDTD->DidBuildModel(anErrorCode,PRBool(0==mParserContext->mPrevContext));
}
//Now it's time to recycle our used tokens.
//The current context has a deque full of them,
//and the ones that preceed currentpos are no
//longer needed. Let's recycle them.
nsDeque& theDeque=mParserContext->mTokenDeque;
nsITokenRecycler* theRecycler=mParserContext->mDTD->GetTokenRecycler();
if(theRecycler) {
CToken* theToken=(CToken*)theDeque.Pop();
while(theToken) {
theRecycler->RecycleToken(theToken);
theToken=(CToken*)theDeque.Pop();
//Now it's time to recycle our used tokens.
//The current context has a deque full of them,
//and the ones that preceed currentpos are no
//longer needed. Let's recycle them.
nsDeque& theDeque=mParserContext->mTokenDeque;
nsITokenRecycler* theRecycler=mParserContext->mDTD->GetTokenRecycler();
if(theRecycler) {
CToken* theToken=(CToken*)theDeque.Pop();
while(theToken) {
theRecycler->RecycleToken(theToken);
theToken=(CToken*)theDeque.Pop();
}
}
}