Browse Source

Fix ImageMetaData test

af/merge-core
James Jackson-South 9 years ago
parent
commit
da6cd47eb5
  1. 5
      src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs
  2. 3
      src/ImageSharp/MetaData/Profiles/ICC/IccProfile.cs

5
src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs

@ -84,9 +84,12 @@ namespace ImageSharp
} }
} }
if (other.data != null)
{
this.data = new byte[other.data.Length]; this.data = new byte[other.data.Length];
Buffer.BlockCopy(other.data, 0, this.data, 0, other.data.Length); Buffer.BlockCopy(other.data, 0, this.data, 0, other.data.Length);
} }
}
/// <summary> /// <summary>
/// Gets or sets which parts will be written when the profile is added to an image. /// Gets or sets which parts will be written when the profile is added to an image.
@ -131,7 +134,7 @@ namespace ImageSharp
return null; return null;
} }
if (this.data.Length < (this.thumbnailOffset + this.thumbnailLength)) if (this.data == null || this.data.Length < (this.thumbnailOffset + this.thumbnailLength))
{ {
return null; return null;
} }

3
src/ImageSharp/MetaData/Profiles/ICC/IccProfile.cs

@ -59,9 +59,12 @@ namespace ImageSharp
Guard.NotNull(other, nameof(other)); Guard.NotNull(other, nameof(other));
// TODO: Do we need to copy anything else? // TODO: Do we need to copy anything else?
if (other.data != null)
{
this.data = new byte[other.data.Length]; this.data = new byte[other.data.Length];
Buffer.BlockCopy(other.data, 0, this.data, 0, other.data.Length); Buffer.BlockCopy(other.data, 0, this.data, 0, other.data.Length);
} }
}
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="IccProfile"/> class. /// Initializes a new instance of the <see cref="IccProfile"/> class.

Loading…
Cancel
Save