refactor: return null when passing empty menu templates (#23364)
This commit is contained in:
parent
59c1c12e0b
commit
0f0cc51b35
4 changed files with 11 additions and 13 deletions
|
@ -173,11 +173,9 @@ Menu.setApplicationMenu = function (menu) {
|
|||
}
|
||||
};
|
||||
|
||||
Menu.buildFromTemplate = function (template, isSubmenu = false) {
|
||||
Menu.buildFromTemplate = function (template) {
|
||||
if (!Array.isArray(template)) {
|
||||
throw new TypeError('Invalid template for Menu: Menu template must be an array');
|
||||
} else if (!isSubmenu && template.length === 0) {
|
||||
throw new TypeError('Invalid template for Menu: Menu template must be an non-empty array');
|
||||
}
|
||||
|
||||
if (!areValidTemplateItems(template)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue