mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-15 00:34:08 +09:00
- fix app crash with old version of IntelPowerGadget (#202)
This commit is contained in:
@@ -280,11 +280,26 @@ public class FrequencyReader: Reader<Double> {
|
||||
return
|
||||
}
|
||||
|
||||
let PG_InitializePointer = CFBundleGetFunctionPointerForName(self.bundle, "PG_Initialize" as CFString)
|
||||
let PG_ShutdownPointer = CFBundleGetFunctionPointerForName(self.bundle, "PG_Shutdown" as CFString)
|
||||
let PG_ReadSamplePointer = CFBundleGetFunctionPointerForName(self.bundle, "PG_ReadSample" as CFString)
|
||||
let PGSample_GetIAFrequencyPointer = CFBundleGetFunctionPointerForName(self.bundle, "PGSample_GetIAFrequency" as CFString)
|
||||
let PGSample_ReleasePointer = CFBundleGetFunctionPointerForName(self.bundle, "PGSample_Release" as CFString)
|
||||
guard let PG_InitializePointer = CFBundleGetFunctionPointerForName(self.bundle, "PG_Initialize" as CFString) else {
|
||||
os_log(.error, log: log, "failed to find PG_Initialize")
|
||||
return
|
||||
}
|
||||
guard let PG_ShutdownPointer = CFBundleGetFunctionPointerForName(self.bundle, "PG_Shutdown" as CFString) else {
|
||||
os_log(.error, log: log, "failed to find PG_Shutdown")
|
||||
return
|
||||
}
|
||||
guard let PG_ReadSamplePointer = CFBundleGetFunctionPointerForName(self.bundle, "PG_ReadSample" as CFString) else {
|
||||
os_log(.error, log: log, "failed to find PG_ReadSample")
|
||||
return
|
||||
}
|
||||
guard let PGSample_GetIAFrequencyPointer = CFBundleGetFunctionPointerForName(self.bundle, "PGSample_GetIAFrequency" as CFString) else {
|
||||
os_log(.error, log: log, "failed to find PGSample_GetIAFrequency")
|
||||
return
|
||||
}
|
||||
guard let PGSample_ReleasePointer = CFBundleGetFunctionPointerForName(self.bundle, "PGSample_Release" as CFString) else {
|
||||
os_log(.error, log: log, "failed to find PGSample_Release")
|
||||
return
|
||||
}
|
||||
|
||||
let PG_Initialize = unsafeBitCast(PG_InitializePointer, to: PG_InitializePointerFunction.self)
|
||||
self.PG_Shutdown = unsafeBitCast(PG_ShutdownPointer, to: PG_ShutdownPointerFunction.self)
|
||||
|
||||
Reference in New Issue
Block a user