Skip to content

Commit

Permalink
gpu: validate if index exists by checking length
Browse files Browse the repository at this point in the history
  • Loading branch information
jrelvas-ipc committed Oct 16, 2023
1 parent 9d20c2c commit 8cddff0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gpu/pick.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ func HandleGpu(target target.TargetGPU, env map[string]string, isVulkan bool) (m
}
}

gpu := gpus[target.Id]

if gpu == nil {
if len(gpus) < target.Id+1 {
return env, errors.New("gpu not found")
}

gpu := gpus[target.Id]

env = gpu.ApplyEnv(env)

return env, nil
Expand Down

0 comments on commit 8cddff0

Please sign in to comment.