This is also specified in the API documentation. Without the fix
there was a crash trying to insert page at index 0
---
src/doc/PdfPagesTree.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/doc/PdfPagesTree.cpp b/src/doc/PdfPagesTree.cpp
index 2ee8ea2..9d851d3 100644
--- a/src/doc/PdfPagesTree.cpp
+++ b/src/doc/PdfPagesTree.cpp
@@ -247,11 +247,11 @@ PdfPage* PdfPagesTree::InsertPage( const PdfRect & rSize,
int atIndex)
{
PdfPage* pPage = new PdfPage( rSize, GetRoot()->GetOwner() );
- if (atIndex < 0 || atIndex >= this->GetTotalNumberOfPages()) {
- atIndex = this->GetTotalNumberOfPages() - 1;
- }
+ if (atIndex < 0 || atIndex > this->GetTotalNumberOfPages()) {
+ atIndex = this->GetTotalNumberOfPages();
+ }
- InsertPage( atIndex - 1, pPage );
+ InsertPage(atIndex, pPage );
m_cache.AddPageObject( atIndex, pPage );
return pPage;
--
2.16.1.windows.1
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users