From df803cd34de6284835f751419dd9d2be471431df Mon Sep 17 00:00:00 2001 From: Stefan Nikolei Date: Wed, 1 Feb 2023 07:39:36 +0100 Subject: [PATCH] Fix nullref the quantizier was initialized with default --> all properties are null. So we need to check that --- src/ImageSharp/Formats/Gif/GifEncoderCore.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs index 9cc045d45..eaa685293 100644 --- a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs @@ -171,7 +171,10 @@ internal sealed class GifEncoderCore : IImageEncoderInternals quantized = null; } - paletteQuantizer.Dispose(); + if (hasPaletteQuantizer) + { + paletteQuantizer.Dispose(); + } } private void EncodeFrame(