From bd4d379d1f2a906f0bec506d1fe2c6b264f57486 Mon Sep 17 00:00:00 2001 From: Johannes Bildstein Date: Thu, 23 Mar 2017 15:05:54 +0100 Subject: [PATCH] matrix cannot be null --- .../Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs | 8 +++----- .../Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs index 6a5d2ca18b..f3807a5849 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs @@ -60,15 +60,13 @@ namespace ImageSharp public IccLut16TagDataEntry(float[,] matrix, IccLut[] inputValues, IccClut clutValues, IccLut[] outputValues, IccProfileTag tagSignature) : base(IccTypeSignature.Lut16, tagSignature) { + Guard.NotNull(matrix, nameof(matrix)); Guard.NotNull(inputValues, nameof(inputValues)); Guard.NotNull(clutValues, nameof(clutValues)); Guard.NotNull(outputValues, nameof(outputValues)); - if (matrix != null) - { - bool is3By3 = matrix.GetLength(0) == 3 && matrix.GetLength(1) == 3; - Guard.IsTrue(is3By3, nameof(matrix), "Matrix must have a size of three by three"); - } + bool is3By3 = matrix.GetLength(0) == 3 && matrix.GetLength(1) == 3; + Guard.IsTrue(is3By3, nameof(matrix), "Matrix must have a size of three by three"); Guard.IsTrue(this.InputChannelCount == clutValues.InputChannelCount, nameof(clutValues), "Input channel count does not match the CLUT size"); Guard.IsTrue(this.OutputChannelCount == clutValues.OutputChannelCount, nameof(clutValues), "Output channel count does not match the CLUT size"); diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs index a60943abba..61f17b7568 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs @@ -60,15 +60,13 @@ namespace ImageSharp public IccLut8TagDataEntry(float[,] matrix, IccLut[] inputValues, IccClut clutValues, IccLut[] outputValues, IccProfileTag tagSignature) : base(IccTypeSignature.Lut8, tagSignature) { + Guard.NotNull(matrix, nameof(matrix)); Guard.NotNull(inputValues, nameof(inputValues)); Guard.NotNull(clutValues, nameof(clutValues)); Guard.NotNull(outputValues, nameof(outputValues)); - if (matrix != null) - { - bool is3By3 = matrix.GetLength(0) == 3 && matrix.GetLength(1) == 3; - Guard.IsTrue(is3By3, nameof(matrix), "Matrix must have a size of three by three"); - } + bool is3By3 = matrix.GetLength(0) == 3 && matrix.GetLength(1) == 3; + Guard.IsTrue(is3By3, nameof(matrix), "Matrix must have a size of three by three"); Guard.IsTrue(this.InputChannelCount == clutValues.InputChannelCount, nameof(clutValues), "Input channel count does not match the CLUT size"); Guard.IsTrue(this.OutputChannelCount == clutValues.OutputChannelCount, nameof(clutValues), "Output channel count does not match the CLUT size");