Browse Source

Added a check for an empty lambda in LambdaCallback::modalStateFinished()

tags/2021-05-28
ed 6 years ago
parent
commit
a4f0b179a3
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      modules/juce_gui_basics/components/juce_ModalComponentManager.cpp

+ 7
- 2
modules/juce_gui_basics/components/juce_ModalComponentManager.cpp View File

@@ -283,8 +283,13 @@ int ModalComponentManager::runEventLoopForCurrentComponent()
//==============================================================================
struct LambdaCallback : public ModalComponentManager::Callback
{
LambdaCallback (std::function<void(int)> fn) noexcept : function (fn) {}
void modalStateFinished (int result) override { function (result); }
LambdaCallback (std::function<void(int)> fn) noexcept : function (fn) {}
void modalStateFinished (int result) override
{
if (function != nullptr)
function (result);
}
std::function<void(int)> function;


Loading…
Cancel
Save