Browse Source

Update IccReader.cs

pull/1567/head
James Jackson-South 3 years ago
parent
commit
d89d8c5b19
  1. 21
      src/ImageSharp/Metadata/Profiles/ICC/IccReader.cs

21
src/ImageSharp/Metadata/Profiles/ICC/IccReader.cs

@ -83,28 +83,19 @@ internal sealed class IccReader
{ {
IccTagTableEntry[] tagTable = ReadTagTable(reader); IccTagTableEntry[] tagTable = ReadTagTable(reader);
List<IccTagDataEntry> entries = new(tagTable.Length); List<IccTagDataEntry> entries = new(tagTable.Length);
Dictionary<uint, IccTagDataEntry> store = new();
foreach (IccTagTableEntry tag in tagTable) foreach (IccTagTableEntry tag in tagTable)
{ {
IccTagDataEntry entry; IccTagDataEntry entry;
if (store.TryGetValue(tag.Offset, out IccTagDataEntry? value))
try
{ {
entry = value; entry = reader.ReadTagDataEntry(tag);
} }
else catch
{ {
try // Ignore tags that could not be read
{ continue;
entry = reader.ReadTagDataEntry(tag);
}
catch
{
// Ignore tags that could not be read
continue;
}
store.Add(tag.Offset, entry);
} }
entry.TagSignature = tag.Signature; entry.TagSignature = tag.Signature;

Loading…
Cancel
Save