Skip to content

Commit

Permalink
Merge pull request #1727 from uubulb/fix_sensors_darwin_arm64
Browse files Browse the repository at this point in the history
sensors: avoid passing nil pointer to CFArrayGetCount
  • Loading branch information
shirou authored Oct 13, 2024
2 parents c9da2cc + 10d9c04 commit a19cede
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sensors/sensors_darwin_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a19cede

Please sign in to comment.