diff options
author | Eike Rathke <erack@redhat.com> | 2014-12-09 03:49:10 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2014-12-09 03:53:58 +0100 |
commit | 887cb59ac4bfca94f310baee3e9da58ccf9cb3e3 (patch) | |
tree | 5803de9a4d2d3b2adb07bbfb962a1ed8a5872068 /sc | |
parent | 1e9aa174865cc65b132a8b3e728b8a5adbcd8b90 (diff) |
assert the "impossible"
Change-Id: I5fd2c7635f204bda982f1df58b4c19fe9b12464a
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/documen7.cxx | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx index 45c9416e77db..5b6c3a430b3f 100644 --- a/sc/source/core/data/documen7.cxx +++ b/sc/source/core/data/documen7.cxx @@ -365,18 +365,30 @@ void ScDocument::RemoveFromFormulaTree( ScFormulaCell* pCell ) { OSL_ENSURE( pCell, "RemoveFromFormulaTree: pCell Null" ); ScFormulaCell* pPrev = pCell->GetPrevious(); - // wenn die Zelle die erste oder sonstwo ist + assert(pPrev != pCell); // pointing to itself?!? + // if the cell is first or somwhere in chain if ( pPrev || pFormulaTree == pCell ) { ScFormulaCell* pNext = pCell->GetNext(); + assert(pNext != pCell); // pointing to itself?!? if ( pPrev ) - pPrev->SetNext( pNext ); // gibt Vorlaeufer + { + assert(pFormulaTree != pCell); // if this cell is also head something's wrong + pPrev->SetNext( pNext ); // predecessor exists, set successor + } else - pFormulaTree = pNext; // ist erste Zelle + { + pFormulaTree = pNext; // this cell was first cell + } if ( pNext ) - pNext->SetPrevious( pPrev ); // gibt Nachfolger + { + assert(pEOFormulaTree != pCell); // if this cell is also tail something's wrong + pNext->SetPrevious( pPrev ); // sucessor exists, set predecessor + } else - pEOFormulaTree = pPrev; // ist letzte Zelle + { + pEOFormulaTree = pPrev; // this cell was last cell + } pCell->SetPrevious( 0 ); pCell->SetNext( 0 ); sal_uInt16 nRPN = pCell->GetCode()->GetCodeLen(); @@ -543,18 +555,30 @@ void ScDocument::RemoveFromFormulaTrack( ScFormulaCell* pCell ) { OSL_ENSURE( pCell, "RemoveFromFormulaTrack: pCell Null" ); ScFormulaCell* pPrev = pCell->GetPreviousTrack(); - // wenn die Zelle die erste oder sonstwo ist + assert(pPrev != pCell); // pointing to itself?!? + // if the cell is first or somwhere in chain if ( pPrev || pFormulaTrack == pCell ) { ScFormulaCell* pNext = pCell->GetNextTrack(); + assert(pNext != pCell); // pointing to itself?!? if ( pPrev ) - pPrev->SetNextTrack( pNext ); // gibt Vorlaeufer + { + assert(pFormulaTrack != pCell); // if this cell is also head something's wrong + pPrev->SetNextTrack( pNext ); // predecessor exists, set successor + } else - pFormulaTrack = pNext; // ist erste Zelle + { + pFormulaTrack = pNext; // this cell was first cell + } if ( pNext ) - pNext->SetPreviousTrack( pPrev ); // gibt Nachfolger + { + assert(pEOFormulaTrack != pCell); // if this cell is also tail something's wrong + pNext->SetPreviousTrack( pPrev ); // sucessor exists, set predecessor + } else - pEOFormulaTrack = pPrev; // ist letzte Zelle + { + pEOFormulaTrack = pPrev; // this cell was last cell + } pCell->SetPreviousTrack( 0 ); pCell->SetNextTrack( 0 ); --nFormulaTrackCount; |