diff options
author | Eike Rathke <erack@redhat.com> | 2017-01-05 16:37:07 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-01-06 00:47:16 +0000 |
commit | a34de7f0e4165db1a64be42044f9d5900d0d3da9 (patch) | |
tree | fa1f731e87362fc0fbcf004fd7b4a9cc6df49bb1 /sc/source | |
parent | 964cf72012b80ee4cab8923939182450bab28a4f (diff) |
check token array code errors when testing for equality, tdf#105024 related
To not end up with a series of equal errors when importing individual error
cells and attempting to group them.
Change-Id: Idfcbb2e7077fc8799ef925c2c2e17188ac5e3b14
(cherry picked from commit 44021bd4018f4f97d9f0f6b6e1f0a256e8853537)
Reviewed-on: https://gerrit.libreoffice.org/32762
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/cellvalue.cxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx index 147ad514f3fb..efe66f789596 100644 --- a/sc/source/core/data/cellvalue.cxx +++ b/sc/source/core/data/cellvalue.cxx @@ -63,6 +63,9 @@ bool equalsFormulaCells( const ScFormulaCell* p1, const ScFormulaCell* p2 ) if (pCode1->GetLen() != pCode2->GetLen()) return false; + if (pCode1->GetCodeError() != pCode2->GetCodeError()) + return false; + sal_uInt16 n = pCode1->GetLen(); formula::FormulaToken** ppToken1 = pCode1->GetArray(); formula::FormulaToken** ppToken2 = pCode2->GetArray(); diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 6616439a5f11..465f0b84e72a 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3844,6 +3844,13 @@ ScFormulaCell::CompareState ScFormulaCell::CompareByTokenArray( ScFormulaCell& r if ( nThisLen != nOtherLen ) return NotEqual; + // No tokens can be an error cell so check error code, otherwise we could + // end up with a series of equal error values instead of individual error + // values. Also if for any reason different errors are set even if all + // tokens are equal, the cells are not equal. + if (pCode->GetCodeError() != rOther.pCode->GetCodeError()) + return NotEqual; + bool bInvariant = true; // check we are basically the same function @@ -3930,6 +3937,12 @@ ScFormulaCell::CompareState ScFormulaCell::CompareByTokenArray( ScFormulaCell& r return NotEqual; } break; + case formula::svError: + { + if (pThisTok->GetError() != pOtherTok->GetError()) + return NotEqual; + } + break; default: ; } |