Check if there are batteries before checking if they are charging
@@ -151,6 +151,7 @@ float BatteryStats::getPower(int batt_num) {
}
bool BatteryStats::isCharging() {
+ if (numBattery() > 0) {
for(int i =0; i < 2; i++) {
string syspath = battPath[i];
string status = syspath + "/status";
@@ -167,11 +168,12 @@ bool BatteryStats::isCharging() {
return true;
}
}
+ }
return false;
-
}
+
bool BatteryStats::fullCharge(){
//check if both batteries are fully charged
int charged =0;
