From bb5317419642f36bac09013184f88e8937b252dd Mon Sep 17 00:00:00 2001 From: reuk Date: Tue, 13 Aug 2024 14:51:34 +0100 Subject: [PATCH] Direct2D: Add null check before reading from D2D texture --- .../juce_graphics/native/juce_Direct2DHwndContext_windows.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp b/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp index 1302d5879c..f4b066abb5 100644 --- a/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp +++ b/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp @@ -615,7 +615,9 @@ public: if (presentParameters.DirtyRectsCount == 0) { D2D1_POINT_2U destPoint { 0, 0 }; - swap.buffer->CopyFromBitmap (&destPoint, paintedPresentation->getPresentationBitmap(), nullptr); + + if (auto bitmap = paintedPresentation->getPresentationBitmap()) + swap.buffer->CopyFromBitmap (&destPoint, bitmap, nullptr); } // Present the freshly painted buffer