From 90ad6b38f2cf4f32ba705659e0fa5f18274dad62 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 5 Oct 2018 22:05:15 +0000 Subject: 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 Commit-Queue: Tom Sepez --- core/fpdfdoc/csection.cpp | 11 +++++------ 1 file 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; -- cgit v1.2.3