mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
fix: fixed app crash when battery is damaged (#2725)
This commit is contained in:
@@ -82,6 +82,9 @@ internal class UsageReader: Reader<Battery_Usage> {
|
||||
|
||||
self.usage.currentCapacity = self.getIntValue("AppleRawCurrentCapacity" as CFString) ?? 0
|
||||
self.usage.designedCapacity = self.getIntValue("DesignCapacity" as CFString) ?? 1
|
||||
if self.usage.designedCapacity == 0 {
|
||||
self.usage.designedCapacity = 1
|
||||
}
|
||||
self.usage.maxCapacity = self.getIntValue((isARM ? "AppleRawMaxCapacity" : "MaxCapacity") as CFString) ?? 1
|
||||
if !isARM {
|
||||
self.usage.state = list[kIOPSBatteryHealthKey] as? String
|
||||
|
||||
Reference in New Issue
Block a user