Skip to content

Commit 4deee69

Browse files
committed
AU Client: Fix calling makeFirstResponder for nil window in Ableton Live
When pressing the Escape key the call to hostView keyDown: closes the plugin window and the subsequent [hostView window] returns nil.
1 parent 8c1ff91 commit 4deee69

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

modules/juce_audio_plugin_client/juce_audio_plugin_client_AU_1.mm

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,11 +1749,13 @@ bool keyPressed (const KeyPress&) override
17491749

17501750
auto* view = (NSView*) getWindowHandle();
17511751
auto* hostView = [view superview];
1752-
auto* hostWindow = [hostView window];
17531752

1754-
[hostWindow makeFirstResponder: hostView];
1753+
[[hostView window] makeFirstResponder: hostView];
17551754
[hostView keyDown: currentEvent];
1756-
[hostWindow makeFirstResponder: view];
1755+
1756+
if ((hostView = [view superview]))
1757+
if (auto* hostWindow = [hostView window])
1758+
[hostWindow makeFirstResponder: view];
17571759
}
17581760
}
17591761
}

0 commit comments

Comments
 (0)