storagecommands: fix sensorTree never updated
Swap the sequence of sensorTree.empty() and getSensorSubtree() in if
statement.
This will fix the issue of sensorTree never get updated.
Change-Id: I225c3641145643ef481aec977ebd4b8b277b2dc8
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
diff --git a/src/storagecommands.cpp b/src/storagecommands.cpp
index 532549a..cf66413 100644
--- a/src/storagecommands.cpp
+++ b/src/storagecommands.cpp
@@ -601,7 +601,7 @@
return IPMI_CC_INVALID_RESERVATION_ID;
}
- if (sensorTree.empty() && !getSensorSubtree(sensorTree))
+ if (!getSensorSubtree(sensorTree) && sensorTree.empty())
{
return IPMI_CC_RESPONSE_ERROR;
}
@@ -823,7 +823,7 @@
static int getSensorConnectionByName(std::string& name, std::string& connection,
std::string& path)
{
- if (sensorTree.empty() && !getSensorSubtree(sensorTree))
+ if (!getSensorSubtree(sensorTree) && sensorTree.empty())
{
return -1;
}