From 80fa86a3ca1cc62143f4d27fd44c590f74bb4985 Mon Sep 17 00:00:00 2001 From: lchauvinQt Date: Tue, 6 Dec 2016 16:28:28 +0100 Subject: [PATCH] Fix random crash while scrolling into the viewer, avoid the index out of range when the " m_currentPage " is not valid --- limereport/lrpreviewreportwidget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/limereport/lrpreviewreportwidget.cpp b/limereport/lrpreviewreportwidget.cpp index b405710..d614193 100644 --- a/limereport/lrpreviewreportwidget.cpp +++ b/limereport/lrpreviewreportwidget.cpp @@ -16,6 +16,8 @@ namespace LimeReport { bool PreviewReportWidgetPrivate::pageIsVisible(){ QGraphicsView* view = q_ptr->ui->graphicsView; + if ( m_currentPage-1 >= m_reportPages.size() || m_currentPage <= 0 ) + return false; PageItemDesignIntf::Ptr page = m_reportPages.at(m_currentPage-1); return page->mapToScene(page->rect()).boundingRect().intersects( view->mapToScene(view->viewport()->geometry()).boundingRect()