fix: null ref when ResizeBuffer() call before scene is init

thanks perch
This commit is contained in:
goat 2021-04-15 21:39:41 +02:00
parent 617b0ee889
commit c22ea31ac6
No known key found for this signature in database
GPG key ID: F18F057873895461

View file

@ -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();