diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-10-05 22:05:15 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-05 22:05:15 +0000 |
commit | 90ad6b38f2cf4f32ba705659e0fa5f18274dad62 (patch) | |
tree | f34ff69bd9106847094095314e0a477fdc49aa25 /core | |
parent | 143cc991e2667720b80ad3e5883a72bf6c5312e1 (diff) | |
download | pdfium-90ad6b38f2cf4f32ba705659e0fa5f18274dad62.tar.xz |
Remove one CSection::m_pVT null check
The one place we create a CSection, the argument is |this| which
can not be null.
Change-Id: Ia216d9d5658f695a694eb7924627c997487de623
Reviewed-on: https://pdfium-review.googlesource.com/c/43571
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/fpdfdoc/csection.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/core/fpdfdoc/csection.cpp b/core/fpdfdoc/csection.cpp index 4484e4c5c0..ad962be55b 100644 --- a/core/fpdfdoc/csection.cpp +++ b/core/fpdfdoc/csection.cpp @@ -14,9 +14,11 @@ #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" -CSection::CSection(CPDF_VariableText* pVT) : m_pVT(pVT) {} +CSection::CSection(CPDF_VariableText* pVT) : m_pVT(pVT) { + ASSERT(m_pVT); +} -CSection::~CSection() {} +CSection::~CSection() = default; void CSection::ResetLinePlace() { int32_t i = 0; @@ -119,7 +121,6 @@ void CSection::UpdateWordPlace(CPVT_WordPlace& place) const { } CPVT_WordPlace CSection::SearchWordPlace(const CFX_PointF& point) const { - ASSERT(m_pVT); CPVT_WordPlace place = GetBeginWordPlace(); bool bUp = true; bool bDown = true; @@ -176,9 +177,7 @@ CPVT_WordPlace CSection::SearchWordPlace(float fx, const CPVT_WordRange& range) const { CPVT_WordPlace wordplace = range.BeginPos; wordplace.nWordIndex = -1; - if (!m_pVT) { - return wordplace; - } + int32_t nLeft = range.BeginPos.nWordIndex; int32_t nRight = range.EndPos.nWordIndex + 1; int32_t nMid = (nLeft + nRight) / 2; |