summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-10-28 14:54:21 +0100
committerJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-10-28 15:02:46 +0100
commit3981e1bf7d45489f772789b8316fe260c4fc20fa (patch)
tree274a142a5c0c8e6806becd970e5aa05400ac2fe5 /src/control
parent5b2c009520e1ee3bdd5c29bb477dd09000f51ad0 (diff)
ControlObject: Simplify and fix static toBool() method
The comparison was changed from `value != 0` to `value > 0`. This is unintuitive and misleading, but it needs to be consistent with the non-static toBool() implementation which does the same. A different outcome depending on whether you call the static or non-static version would be even more confusing.
Diffstat (limited to 'src/control')
-rw-r--r--src/control/controlobject.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/control/controlobject.cpp b/src/control/controlobject.cpp
index c96a852b64..770064f83b 100644
--- a/src/control/controlobject.cpp
+++ b/src/control/controlobject.cpp
@@ -96,8 +96,7 @@ double ControlObject::get(const ConfigKey& key) {
// static
bool ControlObject::toBool(const ConfigKey& key) {
- const double value = ControlObject::get(key);
- return (value != 0);
+ return ControlObject::get(key) > 0;
}
double ControlObject::getParameter() const {