Use backup when PTC compression is corrupt (#1704)
* Use backup when PTC compression is corrupt * Apply suggestions from code review Co-authored-by: LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com> Co-authored-by: LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>
This commit is contained in:
parent
c2356a7653
commit
9852cb9c9e
2 changed files with 21 additions and 3 deletions
|
@ -196,7 +196,16 @@ namespace ARMeilleure.Translation.PTC
|
|||
{
|
||||
int hashSize = md5.HashSize / 8;
|
||||
|
||||
deflateStream.CopyTo(stream);
|
||||
try
|
||||
{
|
||||
deflateStream.CopyTo(stream);
|
||||
}
|
||||
catch
|
||||
{
|
||||
InvalidateCompressedStream(compressedStream);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
stream.Seek(0L, SeekOrigin.Begin);
|
||||
|
||||
|
|
|
@ -120,7 +120,16 @@ namespace ARMeilleure.Translation.PTC
|
|||
{
|
||||
int hashSize = md5.HashSize / 8;
|
||||
|
||||
deflateStream.CopyTo(stream);
|
||||
try
|
||||
{
|
||||
deflateStream.CopyTo(stream);
|
||||
}
|
||||
catch
|
||||
{
|
||||
InvalidateCompressedStream(compressedStream);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
stream.Seek(0L, SeekOrigin.Begin);
|
||||
|
||||
|
|
Loading…
Reference in a new issue