[downloader] Check if resume file actually exists before trying to delete it

This commit is contained in:
derrod 2020-04-21 20:05:03 +02:00
parent 0b6824ba58
commit be8e0169d4

View file

@ -602,10 +602,11 @@ class DLManager(Process):
self.log.warning(f'Thread did not terminate! {repr(t)}')
# clean up resume file
try:
os.remove(self.resume_file)
except OSError as e:
self.log.warning(f'Failed to remove resume file: {e!r}')
if self.resume_file:
try:
os.remove(self.resume_file)
except OSError as e:
self.log.warning(f'Failed to remove resume file: {e!r}')
# close up shared memory
self.shared_memory.close()