canvas.Keybinding.parseShortcut: Accept nil and empty strings, returning nil
This can be used to unset the key binding of a Canvas menu item by using item.setShortcut(nil);
This commit is contained in:
parent
10306ea92d
commit
5f66773605
1 changed files with 2 additions and 1 deletions
|
@ -283,7 +283,7 @@ ModifierKeys.Meta = (ModifierKeys.Meta_L | ModifierKeys.Meta_R);
|
|||
|
||||
var parseShortcut = func(s)
|
||||
{
|
||||
if (size(s) == 0) {
|
||||
if (!s or !isstr(s) or size(s) == 0) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -315,6 +315,7 @@ var parseShortcut = func(s)
|
|||
|
||||
if (keyCode == nil) {
|
||||
logprint(LOG_ALERT, "Unknown key '" ~ baseKey ~ "'");
|
||||
return nil;
|
||||
}
|
||||
|
||||
return [modMask, keyCode];
|
||||
|
|
Loading…
Add table
Reference in a new issue