[run selector] solve accessing None bugs

This commit is contained in:
Noe Brucy
2022-11-25 15:45:42 +01:00
parent df84e6c2d5
commit 191be98733
+5
View File
@@ -452,6 +452,8 @@ class RunSelector:
imax = search(nums, time_max, "left") imax = search(nums, time_max, "left")
if imax is not None: if imax is not None:
nums = nums[: imax + 1] nums = nums[: imax + 1]
else:
nums = []
if time is not None and len(nums) > 0: if time is not None and len(nums) > 0:
filtered_nums = [] filtered_nums = []
@@ -461,10 +463,13 @@ class RunSelector:
# For all times provided by the user, select the output closer to it # For all times provided by the user, select the output closer to it
for t in time: for t in time:
iclose = search(nums, t) iclose = search(nums, t)
if iclose is not None:
num = nums[iclose] num = nums[iclose]
# Only add each selected output once # Only add each selected output once
if num not in filtered_nums: if num not in filtered_nums:
filtered_nums.append(num) filtered_nums.append(num)
else:
break
nums = filtered_nums nums = filtered_nums
else: else:
nums = list(filter(try_load_info, nums)) nums = list(filter(try_load_info, nums))