Browse Source

Fixed a potential crash in ApplicationCommandManager::findDefaultComponentTarget()

tags/2021-05-28
ed 6 years ago
parent
commit
3b36c3e198
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp

+ 6
- 3
modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp View File

@@ -254,10 +254,13 @@ ApplicationCommandTarget* ApplicationCommandManager::findDefaultComponentTarget(
{ {
if (auto* activeWindow = TopLevelWindow::getActiveTopLevelWindow()) 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;
}
} }
} }


Loading…
Cancel
Save