Browse Source

Don't crash when a texture is on a disconnected HDD.

pull/172/head
Adam Johnson 5 years ago
parent
commit
6063bf6f2a
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 17
      korman/exporter/image.py

17
korman/exporter/image.py

@ -143,12 +143,17 @@ class ImageCache:
# the string "//". There isn't much we can do with that, unless the user # the string "//". There isn't much we can do with that, unless the user
# happens to have an unpacked copy lying around somewheres... # happens to have an unpacked copy lying around somewheres...
path = Path(bl_image.filepath_from_user()) path = Path(bl_image.filepath_from_user())
if path.is_file(): try:
cached_image.modify_time = path.stat().st_mtime exists = path.is_file()
if cached_image.export_time and cached_image.export_time < cached_image.modify_time: except OSError:
return None exists = False
else: finally:
cached_image.modify_time = 0 if exists:
cached_image.modify_time = path.stat().st_mtime
if cached_image.export_time and cached_image.export_time < cached_image.modify_time:
return None
else:
cached_image.modify_time = 0
# ensure the data has been loaded from the cache # ensure the data has been loaded from the cache
if cached_image.image_data is None: if cached_image.image_data is None:

Loading…
Cancel
Save