Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Unified Diff: xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp

Issue 1717243002: Fix a crasher in CXFA_LayoutPageMgr::GetAvailHeight() (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
diff --git a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
index 5f30d75ad414187ff3e6dc3fc7157bbc4d3321f4..0427a4a370f5acb02107249196249d88bf31bce5 100644
--- a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
@@ -251,19 +251,19 @@ void CXFA_LayoutPageMgr::SubmitContentItem(
}
}
FX_FLOAT CXFA_LayoutPageMgr::GetAvailHeight() {
+ CXFA_ContainerLayoutItem* pLayoutItem =
+ GetCurrentContainerRecord()->pCurContentArea;
+ if (!pLayoutItem || !pLayoutItem->m_pFormNode)
+ return 0.0f;
FX_FLOAT fAvailHeight =
- GetCurrentContainerRecord()
- ->pCurContentArea->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_H)
- .ToUnit(XFA_UNIT_Pt);
- if (fAvailHeight < XFA_LAYOUT_FLOAT_PERCISION) {
- if (m_pCurrentContainerRecord ==
- m_rgProposedContainerRecord.GetHeadPosition()) {
- fAvailHeight = 0;
- } else {
- fAvailHeight = XFA_LAYOUT_FLOAT_MAX;
- }
- }
- return fAvailHeight;
+ pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt);
+ if (fAvailHeight >= XFA_LAYOUT_FLOAT_PERCISION)
+ return fAvailHeight;
+ if (m_pCurrentContainerRecord ==
+ m_rgProposedContainerRecord.GetHeadPosition()) {
+ return 0.0f;
+ }
+ return XFA_LAYOUT_FLOAT_MAX;
}
static CXFA_Node* XFA_ResolveBreakTarget(CXFA_Node* pPageSetRoot,
FX_BOOL bNewExprStyle,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698