Kaydet (Commit) d7253e61 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Fridrich Štrba

coverity#704674 Unchecked dynamic_cast

Change-Id: I4432ad08fe149e299933443fb6f1c6afc0746cf5
üst 55f6eb27
...@@ -4432,15 +4432,14 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const ...@@ -4432,15 +4432,14 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const
{ {
pGenerated = aGeneratedStack.top(); pGenerated = aGeneratedStack.top();
aGeneratedStack.pop(); aGeneratedStack.pop();
const ScChangeActionContent* pContent = dynamic_cast< const ScChangeActionContent* >( pGenerated ); const ScChangeActionContent& rContent = dynamic_cast<const ScChangeActionContent&>(*pGenerated);
OSL_ENSURE( pContent, "ScChangeTrack::Clone: pContent is null!" ); const ScCellValue& rNewCell = rContent.GetNewCell();
const ScCellValue& rNewCell = pContent->GetNewCell();
if (!rNewCell.isEmpty()) if (!rNewCell.isEmpty())
{ {
ScCellValue aClonedNewCell; ScCellValue aClonedNewCell;
aClonedNewCell.assign(rNewCell, *pDocument); aClonedNewCell.assign(rNewCell, *pDocument);
OUString aNewValue; OUString aNewValue;
pContent->GetNewString( aNewValue, pDocument ); rContent.GetNewString( aNewValue, pDocument );
pClonedTrack->nGeneratedMin = pGenerated->GetActionNumber() + 1; pClonedTrack->nGeneratedMin = pGenerated->GetActionNumber() + 1;
pClonedTrack->AddLoadedGenerated(aClonedNewCell, pGenerated->GetBigRange(), aNewValue); pClonedTrack->AddLoadedGenerated(aClonedNewCell, pGenerated->GetBigRange(), aNewValue);
} }
...@@ -4519,13 +4518,12 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const ...@@ -4519,13 +4518,12 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const
break; break;
case SC_CAT_CONTENT: case SC_CAT_CONTENT:
{ {
const ScChangeActionContent* pContent = dynamic_cast< const ScChangeActionContent* >( pAction ); const ScChangeActionContent& rContent = dynamic_cast<const ScChangeActionContent&>(*pAction);
OSL_ENSURE( pContent, "ScChangeTrack::Clone: pContent is null!" ); const ScCellValue& rOldCell = rContent.GetOldCell();
const ScCellValue& rOldCell = pContent->GetOldCell();
ScCellValue aClonedOldCell; ScCellValue aClonedOldCell;
aClonedOldCell.assign(rOldCell, *pDocument); aClonedOldCell.assign(rOldCell, *pDocument);
OUString aOldValue; OUString aOldValue;
pContent->GetOldString( aOldValue, pDocument ); rContent.GetOldString( aOldValue, pDocument );
ScChangeActionContent* pClonedContent = new ScChangeActionContent( ScChangeActionContent* pClonedContent = new ScChangeActionContent(
pAction->GetActionNumber(), pAction->GetActionNumber(),
...@@ -4539,7 +4537,7 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const ...@@ -4539,7 +4537,7 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const
pDocument, pDocument,
aOldValue ); aOldValue );
const ScCellValue& rNewCell = pContent->GetNewCell(); const ScCellValue& rNewCell = rContent.GetNewCell();
if (!rNewCell.isEmpty()) if (!rNewCell.isEmpty())
{ {
ScCellValue aClonedNewCell; ScCellValue aClonedNewCell;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment