From d50c0a09a58b5c24a2a484e83004c286fe873205 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 17 Jan 2016 20:49:20 +0000 Subject: cppcheck: nullPointer Change-Id: I2f96d4ea73ccf47b2783ade35890c2dd8e558e5f --- sw/source/filter/ww8/wrtww8.cxx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index dff76a786831..ef7c360c4211 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -788,7 +788,7 @@ const SfxPoolItem* MSWordExportBase::HasItem( sal_uInt16 nWhich ) const const SfxPoolItem& MSWordExportBase::GetItem(sal_uInt16 nWhich) const { - const SfxPoolItem* pItem; + assert((m_pISet || m_pChpIter) && "Where is my ItemSet / pChpIter ?"); if (m_pISet) { // if write a EditEngine text, then the WhichIds are greater as @@ -796,16 +796,9 @@ const SfxPoolItem& MSWordExportBase::GetItem(sal_uInt16 nWhich) const // EditEngine Range nWhich = sw::hack::GetSetWhichFromSwDocWhich(*m_pISet, *m_pDoc, nWhich); OSL_ENSURE(nWhich != 0, "All broken, Impossible"); - pItem = &m_pISet->Get(nWhich); - } - else if( m_pChpIter ) - pItem = &m_pChpIter->GetItem( nWhich ); - else - { - OSL_ENSURE( false, "Where is my ItemSet / pChpIter ?" ); - pItem = nullptr; + return m_pISet->Get(nWhich); } - return *pItem; + return m_pChpIter->GetItem( nWhich ); } WW8_WrPlc1::WW8_WrPlc1( sal_uInt16 nStructSz ) -- cgit