Merge pull request #400 from MattKotsenas/feature/avoid-exception-in-readerfactory

Avoid throwing NotSupportedException in ReaderFactory hot path
This commit is contained in:
Adam Hathcock
2018-07-10 08:47:13 +01:00
committed by GitHub
2 changed files with 2 additions and 1 deletions

View File

@@ -49,6 +49,7 @@ namespace SharpCompress.Common.Zip
_lastEntryHeader = null;
uint headerBytes = reader.ReadUInt32();
header = ReadHeader(headerBytes, reader);
if (header == null) { yield break; }
//entry could be zero bytes so we need to know that.
if (header.ZipHeaderType == ZipHeaderType.LocalEntry)

View File

@@ -91,7 +91,7 @@ namespace SharpCompress.Common.Zip
return entry;
}
default:
throw new NotSupportedException("Unknown header: " + headerBytes);
return null;
}
}