[poppler] 2 commits - qt5/demos qt5/src

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 22 17:41:56 UTC 2020


 qt5/demos/thumbnails.cpp |    3 ++-
 qt5/src/poppler-qt5.h    |    2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit e5001ae78d82624e4a1f07b1053c9db5e4643d48
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Jun 22 19:34:02 2020 +0200

    qt5: Document that Document::page can return nullptr

diff --git a/qt5/src/poppler-qt5.h b/qt5/src/poppler-qt5.h
index a5902859..06f6d021 100644
--- a/qt5/src/poppler-qt5.h
+++ b/qt5/src/poppler-qt5.h
@@ -1314,6 +1314,8 @@ delete it;
 	
 	   The caller gets the ownership of the returned object.
 
+	   This function can return nullptr if for some reason the page can't be properly parsed.
+
 	   \param index the page number index
 	*/
 	Page *page(int index) const;
commit 94e00cbe5481a02e84fc29974c7d0089d847d3eb
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Jun 22 19:33:01 2020 +0200

    qt5: demo: Fix crash on broken files

diff --git a/qt5/demos/thumbnails.cpp b/qt5/demos/thumbnails.cpp
index d44b38ad..e5f6049c 100644
--- a/qt5/demos/thumbnails.cpp
+++ b/qt5/demos/thumbnails.cpp
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2009, Shawn Rutledge <shawn.t.rutledge at gmail.com>
  * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ * Copyright (C) 2020, Albert Astals Cid <aacid at kde.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -48,7 +49,7 @@ void ThumbnailsDock::fillInfo()
     QSize maxSize;
     for (int i = 0; i < num; ++i) {
         const Poppler::Page *page = document()->page(i);
-        const QImage image = page->thumbnail();
+        const QImage image = page ? page->thumbnail() : QImage();
         if (!image.isNull()) {
             QListWidgetItem *item = new QListWidgetItem();
             item->setText(QString::number(i + 1));


More information about the poppler mailing list