Skip to content

Commit

Permalink
Fix panic index out of range (#458)
Browse files Browse the repository at this point in the history
* fix: avoid potential panic due to ignored error

* fix: avoid potential panic due to index out of range
  • Loading branch information
nicolasbouffard committed Aug 19, 2024
1 parent 418699b commit e42f148
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ios/instruments/instruments_deviceinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ type ProcessInfo struct {
// ProcessList returns a []ProcessInfo, one for each process running on the iOS device
func (d DeviceInfoService) ProcessList() ([]ProcessInfo, error) {
resp, err := d.channel.MethodCall("runningProcesses")
if err != nil {
return nil, err
}

if len(resp.Payload) == 0 {
return []ProcessInfo{}, nil
}

result := mapToProcInfo(resp.Payload[0].([]interface{}))
return result, err
}
Expand Down

0 comments on commit e42f148

Please sign in to comment.