summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/cellvalue.cxx3
-rw-r--r--sc/source/core/data/formulacell.cxx13
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:
;
}