From a4f0b179a3668e45278717e26af619d41b199cd5 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 29 Apr 2019 10:24:56 +0100 Subject: [PATCH] Added a check for an empty lambda in LambdaCallback::modalStateFinished() --- .../components/juce_ModalComponentManager.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/juce_gui_basics/components/juce_ModalComponentManager.cpp b/modules/juce_gui_basics/components/juce_ModalComponentManager.cpp index 94865c3b96..5c5c44e25d 100644 --- a/modules/juce_gui_basics/components/juce_ModalComponentManager.cpp +++ b/modules/juce_gui_basics/components/juce_ModalComponentManager.cpp @@ -283,8 +283,13 @@ int ModalComponentManager::runEventLoopForCurrentComponent() //============================================================================== struct LambdaCallback : public ModalComponentManager::Callback { - LambdaCallback (std::function fn) noexcept : function (fn) {} - void modalStateFinished (int result) override { function (result); } + LambdaCallback (std::function fn) noexcept : function (fn) {} + + void modalStateFinished (int result) override + { + if (function != nullptr) + function (result); + } std::function function;