diff --git a/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp b/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp index 705a3b436a..3014021ab2 100644 --- a/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp +++ b/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp @@ -176,13 +176,16 @@ public: static void keyChosen (int result, ChangeKeyButton* button) { - if (result != 0 && button != nullptr && button->currentKeyEntryWindow != nullptr) + if (button != nullptr && button->currentKeyEntryWindow != nullptr) { - button->currentKeyEntryWindow->setVisible (false); - button->setNewKey (button->currentKeyEntryWindow->lastPress, false); - } + if (result != 0) + { + button->currentKeyEntryWindow->setVisible (false); + button->setNewKey (button->currentKeyEntryWindow->lastPress, false); + } - button->currentKeyEntryWindow = nullptr; + button->currentKeyEntryWindow = nullptr; + } } void assignNewKey()