From d21b57083b50cf2803cbffa71d279ba00f0a4c56 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Wed, 12 Jun 2024 09:55:22 +0200 Subject: [PATCH] Fixed potential nullref when Destroy gets called repeatedly --- Assets/Scripts/Core/Fsr3UpscalerContext.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Core/Fsr3UpscalerContext.cs b/Assets/Scripts/Core/Fsr3UpscalerContext.cs index da02d9f..2b6a6bd 100644 --- a/Assets/Scripts/Core/Fsr3UpscalerContext.cs +++ b/Assets/Scripts/Core/Fsr3UpscalerContext.cs @@ -125,8 +125,11 @@ namespace FidelityFX DestroyConstantBuffer(ref _spdConstantsBuffer); DestroyConstantBuffer(ref _upscalerConstantsBuffer); - _commandBuffer.Dispose(); - _commandBuffer = null; + if (_commandBuffer != null) + { + _commandBuffer.Dispose(); + _commandBuffer = null; + } } public void Dispatch(Fsr3Upscaler.DispatchDescription dispatchParams)