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,18 +37,20 @@ namespace BizHawk.Client.Common
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
using var bl = ZipStateLoader.LoadAndDetect(Filename, true);
|
try
|
||||||
if (bl == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
using var bl = ZipStateLoader.LoadAndDetect(Filename, true);
|
||||||
}
|
if (bl is null) return false;
|
||||||
|
|
||||||
ClearBeforeLoad();
|
ClearBeforeLoad();
|
||||||
LoadFields(bl, preload);
|
LoadFields(bl, preload);
|
||||||
|
|
||||||
Changes = false;
|
Changes = false;
|
||||||
return true;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool PreLoadHeaderAndLength() => Load(true);
|
public bool PreLoadHeaderAndLength() => Load(true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue