diff --git a/htmlparser/src/nsParserNode.cpp b/htmlparser/src/nsParserNode.cpp
index 0ca6d8016fe..b1f859f5c9e 100644
--- a/htmlparser/src/nsParserNode.cpp
+++ b/htmlparser/src/nsParserNode.cpp
@@ -54,8 +54,10 @@ nsCParserNode::nsCParserNode(CToken* aToken,PRInt32 aLineNumber,nsITokenRecycler
static void RecycleTokens(nsITokenRecycler* aRecycler,nsDeque& aDeque) {
CToken* theToken=0;
- while(theToken=(CToken*)aDeque.Pop()){
- aRecycler->RecycleToken(theToken);
+ if(aRecycler) {
+ while(theToken=(CToken*)aDeque.Pop()){
+ aRecycler->RecycleToken(theToken);
+ }
}
}
diff --git a/parser/htmlparser/src/nsParserNode.cpp b/parser/htmlparser/src/nsParserNode.cpp
index 0ca6d8016fe..b1f859f5c9e 100644
--- a/parser/htmlparser/src/nsParserNode.cpp
+++ b/parser/htmlparser/src/nsParserNode.cpp
@@ -54,8 +54,10 @@ nsCParserNode::nsCParserNode(CToken* aToken,PRInt32 aLineNumber,nsITokenRecycler
static void RecycleTokens(nsITokenRecycler* aRecycler,nsDeque& aDeque) {
CToken* theToken=0;
- while(theToken=(CToken*)aDeque.Pop()){
- aRecycler->RecycleToken(theToken);
+ if(aRecycler) {
+ while(theToken=(CToken*)aDeque.Pop()){
+ aRecycler->RecycleToken(theToken);
+ }
}
}