mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-17 21:58:22 +03:00
fix: off-by-one error in GpuSelector.get_gpu_arg
gpu <= len(self._valid_gpus) should be gpu < len(self._valid_gpus). The list is zero-indexed, so requesting gpu index equal to the list length causes an IndexError. For example, with 2 valid GPUs (indices 0 and 1), requesting gpu=2 passes the check (2 <= 2) but self._valid_gpus[2] is out of bounds.
This commit is contained in:
parent
5a214eb0d1
commit
dfb34367c9
@ -63,7 +63,7 @@ class LibvaGpuSelector:
|
||||
if not self._valid_gpus:
|
||||
return ""
|
||||
|
||||
if gpu <= len(self._valid_gpus):
|
||||
if gpu < len(self._valid_gpus):
|
||||
return self._valid_gpus[gpu]
|
||||
else:
|
||||
logger.warning(f"Invalid GPU index {gpu}, using first valid GPU")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user