From 8a9fea51e5865527fc54f27b127d2685c391570f Mon Sep 17 00:00:00 2001 From: reuk Date: Mon, 9 Sep 2024 17:19:55 +0100 Subject: [PATCH] Direct2D: Avoid rare crashes due to nullptr deref of swapChainThread --- .../juce_graphics/native/juce_Direct2DHwndContext_windows.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp b/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp index d02ef1ff8e..26d4b45c8a 100644 --- a/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp +++ b/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp @@ -393,7 +393,8 @@ private: return false; if (presentation.getPresentation() == nullptr) - presentation = swapChainThread->getFreshPresentation(); + if (swapChainThread != nullptr) + presentation = swapChainThread->getFreshPresentation(); // Paint if: // resources are allocated