From 3b36c3e198a87e02184e02caf2d7d15af38382ef Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 17 May 2019 17:12:52 +0100 Subject: [PATCH] Fixed a potential crash in ApplicationCommandManager::findDefaultComponentTarget() --- .../commands/juce_ApplicationCommandManager.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp b/modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp index 50674ea337..9e3aa868d0 100644 --- a/modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp +++ b/modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp @@ -254,10 +254,13 @@ ApplicationCommandTarget* ApplicationCommandManager::findDefaultComponentTarget( { if (auto* activeWindow = TopLevelWindow::getActiveTopLevelWindow()) { - c = activeWindow->getPeer()->getLastFocusedSubcomponent(); + if (auto* peer = activeWindow->getPeer()) + { + c = peer->getLastFocusedSubcomponent(); - if (c == nullptr) - c = activeWindow; + if (c == nullptr) + c = activeWindow; + } } }