0

genPOI: handle more uuidcache.dat corruption

Apparently the gzip stream can be malformed in a way where it
does read it, but then throws an EOFError when it abruptly ends.

Catch this so we don't error out.
This commit is contained in:
Nicolas F
2019-10-26 02:41:56 +02:00
parent 71d59be4b9
commit 79a5668bd2

View File

@@ -233,7 +233,7 @@ class PlayerDict(dict):
cls.uuid_cache = json.loads(gz.read().decode("utf-8"))
logging.info("Loaded UUID cache from %r with %d entries.",
cache_file, len(cls.uuid_cache.keys()))
except (ValueError, IOError):
except (ValueError, IOError, EOFError):
logging.warning("Failed to load UUID cache -- it might be corrupt.")
cls.uuid_cache = {}
corrupted_cache = cache_file + ".corrupted." + datetime.datetime.now().isoformat()