mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 17:55:27 +00:00
[utils] Show warning if savegame got truncated during packing
This commit is contained in:
parent
099e222a80
commit
ecf6572e5f
|
@ -125,6 +125,11 @@ class SaveGameHelper:
|
||||||
cp = ChunkPart(guid=cur_chunk.guid, offset=cur_buffer.tell(),
|
cp = ChunkPart(guid=cur_chunk.guid, offset=cur_buffer.tell(),
|
||||||
size=min(remaining, 1024 * 1024 - cur_buffer.tell()))
|
size=min(remaining, 1024 * 1024 - cur_buffer.tell()))
|
||||||
_tmp = cf.read(cp.size)
|
_tmp = cf.read(cp.size)
|
||||||
|
if not _tmp:
|
||||||
|
self.log.warning(f'Got EOF for "{f.filename}" with {remaining} bytes remaining! '
|
||||||
|
f'File may have been corrupted/modified.')
|
||||||
|
break
|
||||||
|
|
||||||
cur_buffer.write(_tmp)
|
cur_buffer.write(_tmp)
|
||||||
fhash.update(_tmp) # update sha1 hash with new data
|
fhash.update(_tmp) # update sha1 hash with new data
|
||||||
f.chunk_parts.append(cp)
|
f.chunk_parts.append(cp)
|
||||||
|
|
Loading…
Reference in a new issue