From 233930159fa9bd18af81b9c5c358123d790cb5e9 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 6 Feb 2015 12:55:41 +0000 Subject: coverity#1267636 Logically dead code Change-Id: I3bd06dee1a5536552f79d9eddf5c7059723cba2e --- sw/source/core/doc/textboxhelper.cxx | 9 ++++++--- 1 file 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& r uno::Any SwTextBoxHelper::getByIndex(SdrPage* pPage, sal_Int32 nIndex, std::set& 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(pRet->getUnoShape(), uno::UNO_QUERY)) : uno::Any(); + + if (!pRet) + throw lang::IndexOutOfBoundsException(); + + return uno::makeAny(uno::Reference(pRet->getUnoShape(), uno::UNO_QUERY)); } sal_Int32 SwTextBoxHelper::getOrdNum(const SdrObject* pObject, std::set& rTextBoxes) -- cgit