Fix threshold data copy

Removed storing threshold data in the class as it is being stored
in sensor threshold object.

Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
Change-Id: I86a96c576531c3c2fd62110792791ab2083012ab
diff --git a/virtualSensor.cpp b/virtualSensor.cpp
index c8b70ab..fb6d456 100644
--- a/virtualSensor.cpp
+++ b/virtualSensor.cpp
@@ -81,6 +81,7 @@
     auto threshold = sensorConfig.value("Threshold", empty);
     if (!threshold.empty())
     {
+        Threshold sensorThreshold;
         sensorThreshold.criticalHigh =
             threshold.value("CriticalHigh", defaultHighThreshold);
         sensorThreshold.criticalLow =
@@ -89,10 +90,10 @@
             threshold.value("WarningHigh", defaultHighThreshold);
         sensorThreshold.warningLow =
             threshold.value("WarningLow", defaultLowThreshold);
-    }
 
-    /* Set threshold value to dbus */
-    setSensorThreshold();
+        /* Set threshold value to dbus */
+        setSensorThreshold(sensorThreshold);
+    }
 
     /* Get expression string */
     exprStr = sensorConfig.value("Expression", "");
@@ -167,7 +168,7 @@
     ValueIface::value(value);
 }
 
-void VirtualSensor::setSensorThreshold()
+void VirtualSensor::setSensorThreshold(Threshold& sensorThreshold)
 {
     CriticalInterface::criticalHigh(sensorThreshold.criticalHigh);
     CriticalInterface::criticalLow(sensorThreshold.criticalLow);