mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-24 13:48:56 +08:00
sensors: avoid passing nil pointer to CFArrayGetCount
This commit is contained in:
parent
45e3591650
commit
10d9c04c2e
@ -96,6 +96,10 @@ func (ta *temperatureArm) getProductNames() []string {
|
||||
ta.ioHIDEventSystemClientSetMatching(uintptr(system), uintptr(ta.sensors))
|
||||
matchingsrvs := ta.ioHIDEventSystemClientCopyServices(uintptr(system))
|
||||
|
||||
if matchingsrvs == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
count := ta.cfArrayGetCount(uintptr(matchingsrvs))
|
||||
|
||||
var i int32
|
||||
@ -130,6 +134,10 @@ func (ta *temperatureArm) getThermalValues() []float64 {
|
||||
ta.ioHIDEventSystemClientSetMatching(uintptr(system), uintptr(ta.sensors))
|
||||
matchingsrvs := ta.ioHIDEventSystemClientCopyServices(uintptr(system))
|
||||
|
||||
if matchingsrvs == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
count := ta.cfArrayGetCount(uintptr(matchingsrvs))
|
||||
|
||||
var values []float64
|
||||
|
Loading…
x
Reference in New Issue
Block a user