Fix assert showing default-constructed QPrintPreviewDialog

Fix call to qBound(), avoiding an assert introduced
by ad5c5bb541.

Pick-to: 6.3
Fixes: QTBUG-101297
Change-Id: I823cdfcd2491c6bb4c87058318479d188ca38742
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Friedemann Kleint 2022-02-25 17:25:33 +01:00
parent 5b07f14a4f
commit 95603e09c9

View File

@ -401,7 +401,7 @@ void QPrintPreviewWidgetPrivate::generatePreview()
pictures = printer->d_func()->previewPages();
populateScene(); // i.e. setPreviewPrintedPictures() e.l.
layoutPages();
curPage = qBound(1, curPage, pages.count());
curPage = pages.count() > 0 ? qBound(1, curPage, pages.count()) : 1;
if (fitting)
_q_fit();
emit q->previewChanged();