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

Unified Diff: xfa/fxfa/app/xfa_textlayout.cpp

Issue 1925363002: Do not check pointers before deleting them. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 8 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 | « xfa/fxfa/app/xfa_ffwidget.cpp ('k') | xfa/fxfa/parser/xfa_document_imp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/app/xfa_textlayout.cpp
diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp
index f2479b7d2f92a1e09f5a5b3b7cc07e559a22d99b..9ed84e16040da3ba9d1f382ba134a673f06b4bc6 100644
--- a/xfa/fxfa/app/xfa_textlayout.cpp
+++ b/xfa/fxfa/app/xfa_textlayout.cpp
@@ -996,6 +996,7 @@ int32_t CXFA_TextLayout::CountBlocks() const {
int32_t iCount = m_Blocks.GetSize() / 2;
return iCount > 0 ? iCount : 1;
}
+
FX_BOOL CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize,
const CFX_SizeF& maxSize,
CFX_SizeF& defaultSize) {
@@ -1014,13 +1015,12 @@ FX_BOOL CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize,
if (fLinePos < 0.1f) {
fLinePos = m_textParser.GetFontSize(m_pTextProvider, NULL);
}
- if (m_pTabstopContext) {
- delete m_pTabstopContext;
- m_pTabstopContext = NULL;
- }
+ delete m_pTabstopContext;
+ m_pTabstopContext = nullptr;
defaultSize = CFX_SizeF(m_fMaxWidth, fLinePos);
return TRUE;
}
+
FX_BOOL CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) {
if (size.x < 1) {
return FALSE;
@@ -1035,15 +1035,13 @@ FX_BOOL CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) {
FX_FLOAT fLinePos = 0;
Loader(size, fLinePos, TRUE);
UpdateAlign(size.y, fLinePos);
- if (m_pTabstopContext) {
- delete m_pTabstopContext;
- m_pTabstopContext = NULL;
- }
- if (fHeight) {
+ delete m_pTabstopContext;
+ m_pTabstopContext = nullptr;
+ if (fHeight)
*fHeight = fLinePos;
- }
return TRUE;
}
+
FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) {
if (m_pLoader == NULL || iBlock < 0 || iBlock >= CountBlocks()) {
return FALSE;
« no previous file with comments | « xfa/fxfa/app/xfa_ffwidget.cpp ('k') | xfa/fxfa/parser/xfa_document_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698