Avoid segv in CXFA_FFPageView::GetPageViewRect() after page is gone.
Take advantage of null indicator introduced at a983336d.
Partially fixes the referenced issue.
Bug: chromium:1042915
Change-Id: I4bf907d67197f8b7405aac2b3639563abba264a5
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/65837
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fxfa/cxfa_ffpageview.cpp b/xfa/fxfa/cxfa_ffpageview.cpp
index 1915152..9841699 100644
--- a/xfa/fxfa/cxfa_ffpageview.cpp
+++ b/xfa/fxfa/cxfa_ffpageview.cpp
@@ -120,13 +120,21 @@
}
CFX_RectF CXFA_FFPageView::GetPageViewRect() const {
- return CFX_RectF(0, 0, GetLayoutItem()->GetPageSize());
+ auto* pItem = GetLayoutItem();
+ if (!pItem)
+ return CFX_RectF();
+
+ return CFX_RectF(0, 0, pItem->GetPageSize());
}
CFX_Matrix CXFA_FFPageView::GetDisplayMatrix(const FX_RECT& rtDisp,
int32_t iRotate) const {
- return GetPageMatrix(CFX_RectF(0, 0, GetLayoutItem()->GetPageSize()), rtDisp,
- iRotate, 0);
+ auto* pItem = GetLayoutItem();
+ if (!pItem)
+ return CFX_Matrix();
+
+ return GetPageMatrix(CFX_RectF(0, 0, pItem->GetPageSize()), rtDisp, iRotate,
+ 0);
}
std::unique_ptr<IXFA_WidgetIterator> CXFA_FFPageView::CreateFormWidgetIterator(