forked from mirrors/gecko-dev
Bug 1426936 - When reading the battery capacity on Mac do not assume that a battery is always present; r=dhylands
MozReview-Commit-ID: ArLSxMUE66e --HG-- extra : source : edc74a4258f9d3b7944058abfd0051bb3655476a
This commit is contained in:
parent
8fde6f2e59
commit
1c42dcf92c
1 changed files with 5 additions and 1 deletions
|
|
@ -254,9 +254,13 @@ MacPowerInformationService::HandleChange(void* aContext) {
|
|||
continue;
|
||||
}
|
||||
|
||||
// Get a battery level estimate. This key is required.
|
||||
// Get a battery level estimate. This key is required but does not always
|
||||
// exist.
|
||||
int currentCapacity = 0;
|
||||
const void* cfRef = ::CFDictionaryGetValue(currPowerSourceDesc, CFSTR(kIOPSCurrentCapacityKey));
|
||||
if (!cfRef) {
|
||||
continue;
|
||||
}
|
||||
::CFNumberGetValue((CFNumberRef)cfRef, kCFNumberSInt32Type, ¤tCapacity);
|
||||
|
||||
// This key is also required.
|
||||
|
|
|
|||
Loading…
Reference in a new issue