window null checks

This commit is contained in:
majorro
2025-01-13 23:26:49 +03:00
parent ca0a6ab72c
commit a070493fba

View File

@@ -29,6 +29,7 @@ internal sealed partial class Unpack : BitInput, IRarUnpack, IDisposable
if (!externalWindow)
{
ArrayPool<byte>.Shared.Return(window);
window = null;
}
disposed = true;
}
@@ -125,11 +126,11 @@ internal sealed partial class Unpack : BitInput, IRarUnpack, IDisposable
private void Init(byte[] window)
{
if (window is null)
if (this.window is null && window is null)
{
this.window = ArrayPool<byte>.Shared.Rent(PackDef.MAXWINSIZE);
}
else
else if (window is not null)
{
this.window = window;
externalWindow = true;