[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
+9 -4
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)
num = nums[iclose] if iclose is not None:
# Only add each selected output once num = nums[iclose]
if num not in filtered_nums: # Only add each selected output once
filtered_nums.append(num) if num not in filtered_nums:
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))