修复图片404或者下载失败导致的None存取错误

This commit is contained in:
2022-09-05 13:55:55 +00:00
parent 5393d90990
commit 9be91713e8

View File

@@ -123,8 +123,10 @@ class FileEntry:
if chunk:
f.write(chunk)
self.ok = self._r.ok
self.connect_error = False
except:
self.ok = False
self.connect_error = True
self._fileExist = True if exists(self._abspath) else False
if not self._fileExist:
self._fileSize = 0
@@ -209,7 +211,9 @@ class FileEntries:
if fileEntry.ok and fileEntry._fileExist:
self.__list.append(fileEntry)
return fileEntry
return None
elif not fileEntry.connect_error:
self.__list.append(fileEntry)
return fileEntry
def clear(self):
with self._value_lock: