mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Make GetFileStream safer until fixed
This commit is contained in:
@@ -743,13 +743,22 @@ namespace SabreTools.DatTools
|
||||
if (isZip != null)
|
||||
{
|
||||
BaseArchive? archive = BaseArchive.Create(file);
|
||||
if (archive != null)
|
||||
if (archive == null)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
// TODO: Write entry to a temporary file to avoid over-large in-memory streams
|
||||
// TODO: Once entry is written, replace GetEntryStream implementations
|
||||
ItemType itemType = datItem.GetStringFieldValue(Models.Metadata.DatItem.TypeKey).AsEnumValue<ItemType>();
|
||||
(stream, _) = archive.GetEntryStream(datItem.GetName() ?? itemType.AsStringValue() ?? string.Empty);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore the exception for now -- usually an over-large file
|
||||
stream = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Otherwise, just open the filestream
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user