diff --git a/Tranga/Jobs/JobBoss.cs b/Tranga/Jobs/JobBoss.cs index e803b72..5cfe59f 100644 --- a/Tranga/Jobs/JobBoss.cs +++ b/Tranga/Jobs/JobBoss.cs @@ -60,11 +60,12 @@ public class JobBoss : GlobalBase File.WriteAllText(settings.jobsFilePath, JsonConvert.SerializeObject(this.jobs)); } - public void RemoveJobs(IEnumerable jobsToRemove) + public void RemoveJobs(IEnumerable jobsToRemove) { Log($"Removing {jobsToRemove.Count()} jobs."); - foreach (Job job in jobsToRemove) - RemoveJob(job); + foreach (Job? job in jobsToRemove) + if(job is not null) + RemoveJob(job); } public IEnumerable GetJobsLike(string? connectorName = null, string? internalId = null, string? chapterNumber = null) @@ -143,6 +144,8 @@ public class JobBoss : GlobalBase AddJobToQueue(job); foreach (Queue jobQueue in mangaConnectorJobQueue.Values) { + if(jobQueue.Count < 1) + continue; Job queueHead = jobQueue.Peek(); if (queueHead.progressToken.state is ProgressToken.State.Complete) {