Make the startingSidebarTab fail gracefully when the tab isn't found (closes #17)
This commit is contained in:
parent
c946642873
commit
2484f6a598
1 changed files with 4 additions and 0 deletions
|
|
@ -42,6 +42,10 @@ export function startingSidebarTab() {
|
|||
// #region Implementation
|
||||
Hooks.once(`ready`, () => {
|
||||
const defaultTab = game.settings.get(__ID__, key);
|
||||
if (!(defaultTab in CONFIG.ui.sidebar.TABS)) {
|
||||
Logger.error(`Failed to find starting tab with ID "${defaultTab}", skipping`);
|
||||
return;
|
||||
};
|
||||
if (defaultTab) {
|
||||
Logger.debug(`Changing tab to:`, defaultTab);
|
||||
ui.sidebar.changeTab(defaultTab, `primary`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue