mirror of
https://github.com/derrod/legendary.git
synced 2026-07-31 10:19:03 +00:00
fix: save-sync chunk read crash (#747)
This commit is contained in:
parent
41e3cfab82
commit
aeb61d4eea
|
|
@ -92,12 +92,14 @@ class Chunk:
|
||||||
return self.stored_as & 0x2
|
return self.stored_as & 0x2
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def read_buffer(cls, data, secrets):
|
def read_buffer(cls, data, secrets=None):
|
||||||
_sio = BytesIO(data)
|
_sio = BytesIO(data)
|
||||||
return cls.read(_sio, secrets)
|
return cls.read(_sio, secrets)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def read(cls, bio, secrets=dict()):
|
def read(cls, bio, secrets=None):
|
||||||
|
if secrets is None:
|
||||||
|
secrets = dict()
|
||||||
head_start = bio.tell()
|
head_start = bio.tell()
|
||||||
|
|
||||||
if struct.unpack('<I', bio.read(4))[0] != cls.header_magic:
|
if struct.unpack('<I', bio.read(4))[0] != cls.header_magic:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue