From f47c4bcbcffbfc4de612ccd9640ca7b38e6e8d98 Mon Sep 17 00:00:00 2001 From: Jason Nelson Date: Thu, 10 May 2018 08:09:10 -0700 Subject: [PATCH] Don't use Linq to check if IEnumerable is empty. --- src/ImageSharp/ImageFrameCollection.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ImageSharp/ImageFrameCollection.cs b/src/ImageSharp/ImageFrameCollection.cs index 0318a7068..cacad34a4 100644 --- a/src/ImageSharp/ImageFrameCollection.cs +++ b/src/ImageSharp/ImageFrameCollection.cs @@ -32,7 +32,7 @@ namespace SixLabors.ImageSharp internal ImageFrameCollection(Image parent, IEnumerable> 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)); + } } ///