From c22ea31ac6b86f1913afd60b0dd20c1364a5c2d2 Mon Sep 17 00:00:00 2001 From: goat <16760685+goaaats@users.noreply.github.com> Date: Thu, 15 Apr 2021 21:39:41 +0200 Subject: [PATCH] fix: null ref when ResizeBuffer() call before scene is init thanks perch --- Dalamud/Interface/InterfaceManager.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dalamud/Interface/InterfaceManager.cs b/Dalamud/Interface/InterfaceManager.cs index e47ce0513..37c2b0f1f 100644 --- a/Dalamud/Interface/InterfaceManager.cs +++ b/Dalamud/Interface/InterfaceManager.cs @@ -382,11 +382,13 @@ namespace Dalamud.Interface private IntPtr ResizeBuffersDetour(IntPtr swapChain, uint bufferCount, uint width, uint height, uint newFormat, uint swapChainFlags) { +#if DEBUG Log.Verbose($"Calling resizebuffers swap@{swapChain.ToInt64():X}{bufferCount} {width} {height} {newFormat} {swapChainFlags}"); +#endif // We have to ensure we're working with the main swapchain, // as viewports might be resizing as well - if (swapChain != this.scene.SwapChain.NativePointer) + if (this.scene == null || swapChain != this.scene.SwapChain.NativePointer) return resizeBuffersHook.Original(swapChain, bufferCount, width, height, newFormat, swapChainFlags); this.scene?.OnPreResize();