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
{
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;
......
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