sensors: buildjson: minor min/max cleanup
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I9d01753a40f1146d49e1a03a18dbea704f3fff84
diff --git a/sensors/buildjson.cpp b/sensors/buildjson.cpp
index 42a9286..f5449eb 100644
--- a/sensors/buildjson.cpp
+++ b/sensors/buildjson.cpp
@@ -41,24 +41,19 @@
j.at("writePath").get_to(s.writePath);
}
+ s.min = 0;
+ s.max = 0;
+
/* The min field is optional in a configuration. */
auto min = j.find("min");
- if (min == j.end())
- {
- s.min = 0;
- }
- else
+ if (min != j.end())
{
j.at("min").get_to(s.min);
}
/* The max field is optional in a configuration. */
auto max = j.find("max");
- if (max == j.end())
- {
- s.max = 0;
- }
- else
+ if (max != j.end())
{
j.at("max").get_to(s.max);
}