Index: fpdfsdk/src/javascript/Document.cpp |
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp |
index b0ca69b5bad2c7adad593bb29440aa2d2567b9a7..f4a1090c3d5985ab79ecde74e5e0235300bce96b 100644 |
--- a/fpdfsdk/src/javascript/Document.cpp |
+++ b/fpdfsdk/src/javascript/Document.cpp |
@@ -1259,14 +1259,14 @@ void IconTree::InsertIconElement(IconElement* pNewIcon) { |
if (!pNewIcon) |
return; |
- if (m_pHead == NULL && m_pEnd == NULL) { |
- m_pHead = m_pEnd = pNewIcon; |
- m_iLength++; |
- } else { |
+ if (m_pHead || m_pEnd) { |
m_pEnd->NextIcon = pNewIcon; |
m_pEnd = pNewIcon; |
- m_iLength++; |
+ } else { |
+ m_pHead = pNewIcon; |
+ m_pEnd = pNewIcon; |
} |
+ m_iLength++; |
} |
void IconTree::DeleteIconTree() { |