summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_document.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/parser/cpdf_document.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_document.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index 8ff9e66506..c047085cf3 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -503,9 +503,11 @@ CPDF_Dictionary* CPDF_Document::GetPage(int iPage) {
// TODO(art-snake): optimize this.
ResetTraversal();
}
- int nPagesToGo = iPage - m_iNextPageToTraverse + 1;
- if (m_pTreeTraversal.empty())
+ if (m_pTreeTraversal.empty()) {
+ ResetTraversal();
m_pTreeTraversal.push_back(std::make_pair(pPages, 0));
+ }
+ int nPagesToGo = iPage - m_iNextPageToTraverse + 1;
CPDF_Dictionary* pPage = TraversePDFPages(iPage, &nPagesToGo, 0);
m_iNextPageToTraverse = iPage + 1;
return pPage;