2
0

Fix multiple enumeration

This commit is contained in:
glax 2023-10-04 09:33:11 +02:00
parent 13075a8704
commit d3ccddd8db

View File

@ -62,8 +62,9 @@ public class JobBoss : GlobalBase
public void RemoveJobs(IEnumerable<Job?> jobsToRemove)
{
Log($"Removing {jobsToRemove.Count()} jobs.");
foreach (Job? job in jobsToRemove)
List<Job?> toRemove = jobsToRemove.ToList(); //Prevent multiple enumeration
Log($"Removing {toRemove.Count()} jobs.");
foreach (Job? job in toRemove)
if(job is not null)
RemoveJob(job);
}