diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-05-26 15:21:32 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-05-26 15:52:00 +0100 |
commit | 088d53701f9b756f70af844ac53239c49cccb5c7 (patch) | |
tree | 60c0e8e3695c4ef669f524d51a0e31a854d82af9 /sc | |
parent | 8ce3c6f7c30f6f816ffd14cb640a7d0b1458860c (diff) |
coverity#704674 Unchecked dynamic_cast
Change-Id: I4432ad08fe149e299933443fb6f1c6afc0746cf5
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/chgtrack.cxx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index 067ff74b8c39..66260226f9f1 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -4432,15 +4432,14 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const { pGenerated = aGeneratedStack.top(); aGeneratedStack.pop(); - const ScChangeActionContent* pContent = dynamic_cast< const ScChangeActionContent* >( pGenerated ); - OSL_ENSURE( pContent, "ScChangeTrack::Clone: pContent is null!" ); - const ScCellValue& rNewCell = pContent->GetNewCell(); + const ScChangeActionContent& rContent = dynamic_cast<const ScChangeActionContent&>(*pGenerated); + const ScCellValue& rNewCell = rContent.GetNewCell(); if (!rNewCell.isEmpty()) { ScCellValue aClonedNewCell; aClonedNewCell.assign(rNewCell, *pDocument); OUString aNewValue; - pContent->GetNewString( aNewValue, pDocument ); + rContent.GetNewString( aNewValue, pDocument ); pClonedTrack->nGeneratedMin = pGenerated->GetActionNumber() + 1; pClonedTrack->AddLoadedGenerated(aClonedNewCell, pGenerated->GetBigRange(), aNewValue); } @@ -4519,13 +4518,12 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const break; case SC_CAT_CONTENT: { - const ScChangeActionContent* pContent = dynamic_cast< const ScChangeActionContent* >( pAction ); - OSL_ENSURE( pContent, "ScChangeTrack::Clone: pContent is null!" ); - const ScCellValue& rOldCell = pContent->GetOldCell(); + const ScChangeActionContent& rContent = dynamic_cast<const ScChangeActionContent&>(*pAction); + const ScCellValue& rOldCell = rContent.GetOldCell(); ScCellValue aClonedOldCell; aClonedOldCell.assign(rOldCell, *pDocument); OUString aOldValue; - pContent->GetOldString( aOldValue, pDocument ); + rContent.GetOldString( aOldValue, pDocument ); ScChangeActionContent* pClonedContent = new ScChangeActionContent( pAction->GetActionNumber(), @@ -4539,7 +4537,7 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const pDocument, aOldValue ); - const ScCellValue& rNewCell = pContent->GetNewCell(); + const ScCellValue& rNewCell = rContent.GetNewCell(); if (!rNewCell.isEmpty()) { ScCellValue aClonedNewCell; |