From 88d2edf1891e6aadce7e62a6fd030e046782e818 Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 22 Jul 2021 15:44:39 +0100 Subject: [PATCH] ModalCallbackFunction: Use NullCheckedInvocation helper to fix potential crash due to calling null std::function --- modules/juce_gui_basics/components/juce_ModalComponentManager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/juce_gui_basics/components/juce_ModalComponentManager.h b/modules/juce_gui_basics/components/juce_ModalComponentManager.h index 36aa32d239..61f0038ef6 100644 --- a/modules/juce_gui_basics/components/juce_ModalComponentManager.h +++ b/modules/juce_gui_basics/components/juce_ModalComponentManager.h @@ -176,7 +176,7 @@ public: struct Callable : public ModalComponentManager::Callback { explicit Callable (CallbackFn&& f) : fn (std::forward (f)) {} - void modalStateFinished (int result) override { fn (result); } + void modalStateFinished (int result) override { NullCheckedInvocation::invoke (std::move (fn), result); } std::remove_reference_t fn; };