Add check for array length

This commit is contained in:
Ingo Oppermann 2025-06-25 15:20:58 +02:00
parent 5a90c3ce20
commit fba9a75d8a
No known key found for this signature in database
GPG Key ID: 2AB32426E9DD229E

View File

@ -324,7 +324,7 @@ func (r *restream) resourceObserver(ctx context.Context, rsc resources.Resources
defer t.Release(token)
limitGPU := false
gpuindex := t.GetHWDevice()
if gpuindex >= 0 {
if gpuindex >= 0 && len(limitGPUs) >= gpuindex+1 {
limitGPU = limitGPUs[gpuindex]
}
if t.Limit(limitCPU, limitMemory, limitGPU) {