mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-11 18:24:43 +02:00
Desktop: Fixes #4049: Keymap editor crash when an invalid command is used
This commit is contained in:
parent
496b19b3f1
commit
0cfcc00912
@ -30,9 +30,14 @@ const getLabel = (commandName: string):string => {
|
|||||||
return _('Command palette');
|
return _('Command palette');
|
||||||
case 'config':
|
case 'config':
|
||||||
return shim.isMac() ? _('Preferences') : _('Options');
|
return shim.isMac() ? _('Preferences') : _('Options');
|
||||||
default:
|
|
||||||
throw new Error(`Command: ${commandName} is unknown`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We don't throw an error if a command is not found because if for
|
||||||
|
// example a command is removed from one version to the next, or a
|
||||||
|
// command is renamed, we still want the keymap editor to work. So in
|
||||||
|
// that case, we simply display the command name and it is up to the
|
||||||
|
// user to fix the shortcut if needed.
|
||||||
|
return `${commandName} (${_('Invalid')})`;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default getLabel;
|
export default getLabel;
|
||||||
|
Loading…
Reference in New Issue
Block a user