summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej@ahunt.org>2015-06-01 17:51:48 +0100
committerAndrzej Hunt <andrzej@ahunt.org>2015-10-20 18:18:37 +0200
commit70bb65f5e385857e1eaedc49e4422ec339a8c9c9 (patch)
tree47bb99b202bd7d388b95b337e731c0098302e3dd
parentImplement units conversion dialog. (diff)
downloadcore-70bb65f5e385857e1eaedc49e4422ec339a8c9c9.tar.gz
core-70bb65f5e385857e1eaedc49e4422ec339a8c9c9.zip
Invalid formulas can't have unit correctness verified.
Formulas that can't be processed will already be treated as invalid, we shouldn't additionally complain about unit verification in this case. Change-Id: I0556bf76b6e2343cdf27ec53669e6fd78da9280b
-rw-r--r--sc/source/core/units/unitsimpl.cxx12
1 files changed, 2 insertions, 10 deletions
diff --git a/sc/source/core/units/unitsimpl.cxx b/sc/source/core/units/unitsimpl.cxx
index e764aad6c2d7..567265bb2a6d 100644
--- a/sc/source/core/units/unitsimpl.cxx
+++ b/sc/source/core/units/unitsimpl.cxx
@@ -95,10 +95,7 @@ UnitsResult UnitsImpl::getOutputUnitsForOpCode(stack< RAUSItem >& rStack, const
if (nOpCode >= SC_OPCODE_START_UN_OP &&
nOpCode < SC_OPCODE_STOP_UN_OP) {
- if (rStack.size() == 0) {
- SAL_WARN("sc.units", "Single item opcode failed (no stack items, or range used)");
- return { UnitsStatus::UNITS_INVALID, boost::none };
- } else if (rStack.top().type != RAUSItemType::UNITS) {
+ if ((rStack.size() == 0) || (rStack.top().type != RAUSItemType::UNITS)) {
return { UnitsStatus::UNITS_UNKNOWN, boost::none };
}
@@ -129,12 +126,7 @@ UnitsResult UnitsImpl::getOutputUnitsForOpCode(stack< RAUSItem >& rStack, const
} else if (nOpCode >= SC_OPCODE_START_BIN_OP &&
nOpCode < SC_OPCODE_STOP_BIN_OP) {
- if (rStack.size() < 2) {
- SAL_WARN("sc.units", "less than two items on stack when attempting binary operation");
- return { UnitsStatus::UNITS_INVALID, boost::none };
- }
-
- if (rStack.top().type != RAUSItemType::UNITS) {
+ if ((rStack.size() < 2) || (rStack.top().type != RAUSItemType::UNITS)) {
return { UnitsStatus::UNITS_UNKNOWN, boost::none };
}
UtUnit pSecondUnit = boost::get<UtUnit>(rStack.top().item);