diff --git a/src/ImageSharp/Formats/Png/PngEncoder.cs b/src/ImageSharp/Formats/Png/PngEncoder.cs
index a4ae1ca0b..a8c1de939 100644
--- a/src/ImageSharp/Formats/Png/PngEncoder.cs
+++ b/src/ImageSharp/Formats/Png/PngEncoder.cs
@@ -1,5 +1,6 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
+#nullable disable
using SixLabors.ImageSharp.Advanced;
@@ -13,11 +14,9 @@ public class PngEncoder : QuantizingImageEncoder
///
/// Initializes a new instance of the class.
///
- public PngEncoder() =>
-
- // We set the quantizer to null here to allow the underlying encoder to create a
- // quantizer with options appropriate to the encoding bit depth.
- this.Quantizer = null!;
+ // We set the quantizer to null here to allow the underlying encoder to create a
+ // quantizer with options appropriate to the encoding bit depth.
+ public PngEncoder() => this.Quantizer = null;
///
/// Gets the number of bits per sample or per palette index (not per pixel).
diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs
index 17fb40446..509837e70 100644
--- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs
+++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs
@@ -206,8 +206,6 @@ internal sealed class PngEncoderCore : IImageEncoderInternals, IDisposable
{
this.previousScanline?.Dispose();
this.currentScanline?.Dispose();
- this.previousScanline = null!;
- this.currentScanline = null!;
}
///