Browse Source

Don't use Linq to check if IEnumerable is empty.

af/merge-core
Jason Nelson 8 years ago
parent
commit
f47c4bcbcf
  1. 8
      src/ImageSharp/ImageFrameCollection.cs

8
src/ImageSharp/ImageFrameCollection.cs

@ -32,7 +32,7 @@ namespace SixLabors.ImageSharp
internal ImageFrameCollection(Image<TPixel> parent, IEnumerable<ImageFrame<TPixel>> frames)
{
Guard.NotNull(parent, nameof(parent));
Guard.NotNullOrEmpty(frames, nameof(frames));
Guard.NotNull(frames, nameof(frames));
this.parent = parent;
@ -42,6 +42,12 @@ namespace SixLabors.ImageSharp
this.ValidateFrame(f);
this.frames.Add(f);
}
// Ensure at least 1 frame was added to the frames collection
if (this.frames.Count == 0)
{
throw new ArgumentException("Must not be empty.", nameof(frames));
}
}
/// <summary>

Loading…
Cancel
Save