Improve error message shown for malformed `.bk2`/`.tasproj`
of course I didn't test it
This commit is contained in:
parent
5be9e03a30
commit
51dab92826
|
@ -37,17 +37,19 @@ namespace BizHawk.Client.Common
|
|||
return false;
|
||||
}
|
||||
|
||||
using var bl = ZipStateLoader.LoadAndDetect(Filename, true);
|
||||
if (bl == null)
|
||||
try
|
||||
{
|
||||
return false;
|
||||
using var bl = ZipStateLoader.LoadAndDetect(Filename, true);
|
||||
if (bl is null) return false;
|
||||
ClearBeforeLoad();
|
||||
LoadFields(bl, preload);
|
||||
Changes = false;
|
||||
return true;
|
||||
}
|
||||
catch (InvalidDataException e) when (e.StackTrace.Contains("ZipArchive.ReadEndOfCentralDirectory"))
|
||||
{
|
||||
throw new Exception("Archive appears to be corrupt. Make a backup, then try to repair it with e.g. 7-Zip.", e);
|
||||
}
|
||||
|
||||
ClearBeforeLoad();
|
||||
LoadFields(bl, preload);
|
||||
|
||||
Changes = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool PreLoadHeaderAndLength() => Load(true);
|
||||
|
|
Loading…
Reference in New Issue