diff --git a/src/cascadia/TerminalSettingsEditor/Actions.cpp b/src/cascadia/TerminalSettingsEditor/Actions.cpp index 4f65c8cba..8e3a06a07 100644 --- a/src/cascadia/TerminalSettingsEditor/Actions.cpp +++ b/src/cascadia/TerminalSettingsEditor/Actions.cpp @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT license. #include "pch.h" @@ -369,7 +369,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation { const auto kbdVM{ get_self(_KeyBindingList.GetAt(i)) }; const auto& otherKeys{ kbdVM->CurrentKeys() }; - if (keys.Modifiers() == otherKeys.Modifiers() && keys.Vkey() == otherKeys.Vkey()) + if (otherKeys && keys.Modifiers() == otherKeys.Modifiers() && keys.Vkey() == otherKeys.Vkey()) { return i; } diff --git a/src/cascadia/TerminalSettingsModel/ActionMap.cpp b/src/cascadia/TerminalSettingsModel/ActionMap.cpp index 6472245aa..1bd4aa390 100644 --- a/src/cascadia/TerminalSettingsModel/ActionMap.cpp +++ b/src/cascadia/TerminalSettingsModel/ActionMap.cpp @@ -94,15 +94,14 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation static void RegisterShortcutAction(ShortcutAction shortcutAction, std::unordered_map& list, std::unordered_set& visited) { const auto actionAndArgs{ make_self(shortcutAction) }; - if (actionAndArgs->Action() != ShortcutAction::Invalid) + /*We have a valid action.*/ + /*Check if the action was already added.*/ + if (visited.find(Hash(*actionAndArgs)) == visited.end()) { - /*We have a valid action.*/ - /*Check if the action was already added.*/ - if (visited.find(Hash(*actionAndArgs)) == visited.end()) + /*This is an action that wasn't added!*/ + /*Let's add it if it has a name.*/ + if (const auto name{ actionAndArgs->GenerateName() }; !name.empty()) { - /*This is an action that wasn't added!*/ - /*Let's add it.*/ - const auto name{ actionAndArgs->GenerateName() }; list.insert({ name, *actionAndArgs }); } }