commit | 6aae76f435209f6324c18f0ba3376ade7f35b848 | [log] [tgz] |
---|---|---|
author | Kun Yi <kunyi731@gmail.com> | Wed Jul 10 21:58:32 2019 -0700 |
committer | Kun Yi <kunyi731@gmail.com> | Wed Jul 10 21:58:32 2019 -0700 |
tree | de3f65365764c043fec703e678b56f65e9f88893 | |
parent | 5e52eab95dc943511c37a3c94a14f7bd0cabec18 [diff] [blame] |
util: Avoid division by invalid value Check for max > min before dividing by difference Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: Ic2a983bb6f7c04f1deafcab228b76ff60012f011
diff --git a/dbus/util.cpp b/dbus/util.cpp index 6d5d2c0..33e0985 100644 --- a/dbus/util.cpp +++ b/dbus/util.cpp
@@ -187,7 +187,7 @@ void scaleSensorReading(const double min, const double max, double& value) { - if (max <= 0) + if (max <= 0 || max <= min) { return; }