Catch a possible error with PK3 reading.

This commit is contained in:
sphere 2021-05-15 22:28:11 +02:00
parent c8f83515e4
commit 58e644aa80

View file

@ -434,7 +434,20 @@ namespace CodeImp.DoomBuilder.Data
if(string.Compare(entry.Key, fn, true) == 0)
{
filedata = new MemoryStream();
entry.WriteTo(filedata);
try
{
entry.WriteTo(filedata);
}
catch(SharpCompress.Compressor.Deflate.ZlibException)
{
// This happens when the PK3 was modified externally and the resources were not reloaded
General.ErrorLogger.Add(ErrorType.Error, "Cannot load the file \"" + filename + "\" from archive \"" + location.location + "\". Did you modify the archive without reloading the resouces?");
filedata.Dispose();
filedata = null;
return null;
}
break;
}
}