diff --git a/restream/core.go b/restream/core.go index f954739f..270b66c8 100644 --- a/restream/core.go +++ b/restream/core.go @@ -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) {