summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-02-06 12:55:41 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-02-06 16:45:14 +0000
commit233930159fa9bd18af81b9c5c358123d790cb5e9 (patch)
treeebff15f253e7398e2f40a2063c6693eea4810951 /sw
parent9e90c4d72e414c9bff86fad8a87c7f584486a08d (diff)
coverity#1267636 Logically dead code
Change-Id: I3bd06dee1a5536552f79d9eddf5c7059723cba2e
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/textboxhelper.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index f5096a0c762b..28471b48ec7c 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -222,7 +222,7 @@ sal_Int32 SwTextBoxHelper::getCount(SdrPage* pPage, std::set<const SwFrmFmt*>& r
uno::Any SwTextBoxHelper::getByIndex(SdrPage* pPage, sal_Int32 nIndex, std::set<const SwFrmFmt*>& rTextBoxes) throw(lang::IndexOutOfBoundsException)
{
- if (nIndex < 0 || nIndex >= getCount(pPage, rTextBoxes))
+ if (nIndex < 0)
throw lang::IndexOutOfBoundsException();
SdrObject* pRet = 0;
@@ -238,8 +238,11 @@ uno::Any SwTextBoxHelper::getByIndex(SdrPage* pPage, sal_Int32 nIndex, std::set<
}
++nCount;
}
- assert(pRet);
- return pRet ? uno::makeAny(uno::Reference<drawing::XShape>(pRet->getUnoShape(), uno::UNO_QUERY)) : uno::Any();
+
+ if (!pRet)
+ throw lang::IndexOutOfBoundsException();
+
+ return uno::makeAny(uno::Reference<drawing::XShape>(pRet->getUnoShape(), uno::UNO_QUERY));
}
sal_Int32 SwTextBoxHelper::getOrdNum(const SdrObject* pObject, std::set<const SwFrmFmt*>& rTextBoxes)