diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-05-12 09:09:56 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-05-12 09:28:13 +0100 |
commit | 510b667023ac2069021f9ccd76efd4989e09a1ce (patch) | |
tree | 72ccf84d39eea46af26b0717366ce5dc8fcc2050 /sw/source | |
parent | a31874f38a179d89dcc9eaedcbcf21dc34f3b9fe (diff) |
coverity#1406101 Dereference null return value
and
coverity#1406100 Dereference null return value
coverity#1406099 Dereference null return value
coverity#1406098 Dereference null return value
coverity#1406097 Dereference null return value
Change-Id: I26d5c0f2e69dc049a87a607ca28586dc575a8ca3
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/doc/doclay.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/undo/unattr.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/undo/undobj1.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/unocore/unodraw.cxx | 5 |
4 files changed, 17 insertions, 10 deletions
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 0685cf164a9f..1d9859554c29 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -800,9 +800,11 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable, SwTextAttr * const pHint = pTextNode->GetTextAttrForCharAt(nIdx, RES_TXTATR_FLYCNT); - OSL_ENSURE( pHint && pHint->Which() == RES_TXTATR_FLYCNT, + assert(pHint && "Missing Hint."); + + OSL_ENSURE( pHint->Which() == RES_TXTATR_FLYCNT, "Missing FlyInCnt-Hint." ); - OSL_ENSURE( pHint && pHint->GetFlyCnt().GetFrameFormat() == pOldFormat, + OSL_ENSURE( pHint->GetFlyCnt().GetFrameFormat() == pOldFormat, "Wrong TextFlyCnt-Hint." ); const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt()).SetFlyFormat( @@ -1117,10 +1119,12 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable SwTextAttr * const pHint = pTextNode->GetTextAttrForCharAt( nIdx, RES_TXTATR_FLYCNT ); + assert(pHint && "Missing Hint."); + #if OSL_DEBUG_LEVEL > 0 - OSL_ENSURE( pHint && pHint->Which() == RES_TXTATR_FLYCNT, + OSL_ENSURE( pHint->Which() == RES_TXTATR_FLYCNT, "Missing FlyInCnt-Hint." ); - OSL_ENSURE( pHint && pHint->GetFlyCnt(). + OSL_ENSURE( pHint->GetFlyCnt(). GetFrameFormat() == static_cast<SwFrameFormat*>(pOldFormat), "Wrong TextFlyCnt-Hint." ); #endif diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index 96dbd48c54ec..deaf037a82fd 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -463,9 +463,10 @@ bool SwUndoFormatAttr::RestoreFlyAnchor(::sw::UndoRedoContext & rContext) const sal_Int32 nIdx = pPos->nContent.GetIndex(); SwTextAttr * const pHint = pTextNode->GetTextAttrForCharAt( nIdx, RES_TXTATR_FLYCNT ); - OSL_ENSURE( pHint && pHint->Which() == RES_TXTATR_FLYCNT, + assert(pHint && "Missing Hint."); + OSL_ENSURE( pHint->Which() == RES_TXTATR_FLYCNT, "Missing FlyInCnt-Hint." ); - OSL_ENSURE( pHint && pHint->GetFlyCnt().GetFrameFormat() == pFrameFormat, + OSL_ENSURE( pHint->GetFlyCnt().GetFrameFormat() == pFrameFormat, "Wrong TextFlyCnt-Hint." ); const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt()).SetFlyFormat(); diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index 2379b521afa6..65b6db6aad38 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -557,9 +557,10 @@ void SwUndoSetFlyFormat::UndoImpl(::sw::UndoRedoContext & rContext) const sal_Int32 nIdx = pPos->nContent.GetIndex(); SwTextAttr * pHint = pTextNode->GetTextAttrForCharAt( nIdx, RES_TXTATR_FLYCNT ); - OSL_ENSURE( pHint && pHint->Which() == RES_TXTATR_FLYCNT, + assert(pHint && "Missing Hint."); + OSL_ENSURE( pHint->Which() == RES_TXTATR_FLYCNT, "Missing FlyInCnt-Hint." ); - OSL_ENSURE( pHint && pHint->GetFlyCnt().GetFrameFormat() == pFrameFormat, + OSL_ENSURE( pHint->GetFlyCnt().GetFrameFormat() == pFrameFormat, "Wrong TextFlyCnt-Hint." ); const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt()).SetFlyFormat(); diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 6f4c5d2de9d2..b155e81b2c0d 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -1273,9 +1273,10 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a SwTextAttr * const pHint = pTextNode->GetTextAttrForCharAt( nIdx, RES_TXTATR_FLYCNT ); - SAL_WARN_IF( !pHint || pHint->Which() != RES_TXTATR_FLYCNT, + assert(pHint && "Missing Hint."); + SAL_WARN_IF( pHint->Which() != RES_TXTATR_FLYCNT, "sw.uno", "Missing FlyInCnt-Hint." ); - SAL_WARN_IF( !pHint || pHint->GetFlyCnt().GetFrameFormat() != pFlyFormat, + SAL_WARN_IF( pHint->GetFlyCnt().GetFrameFormat() != pFlyFormat, "sw.uno", "Wrong TextFlyCnt-Hint." ); const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt()) .SetFlyFormat(); |