EWW_BATTERY is empty string when its {total_avg} property would otherwise be NaN (#425)
Fixes #373
This commit is contained in:
parent
776dc787e7
commit
fe4097c73e
1 changed files with 4 additions and 2 deletions
|
@ -149,9 +149,11 @@ pub fn get_battery_capacity() -> Result<String> {
|
|||
}
|
||||
}
|
||||
}
|
||||
json.pop();
|
||||
json.push_str(&format!(r#", "total_avg": {:.1}}}"#, (current / total) * 100_f64));
|
||||
if total == 0_f64 {
|
||||
return Ok(String::from(""));
|
||||
}
|
||||
|
||||
json.push_str(&format!(r#" "total_avg": {:.1}}}"#, (current / total) * 100_f64));
|
||||
Ok(json)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue