diff --git a/src/services/tabs.fg.move.ts b/src/services/tabs.fg.move.ts index 141f7887..31f42ce8 100644 --- a/src/services/tabs.fg.move.ts +++ b/src/services/tabs.fg.move.ts @@ -26,6 +26,15 @@ export async function move( if (dst.windowId === NOID) return } + // Check if target panel exists + if (dst.panelId) { + const dstPanel = Sidebar.panelsById[dst.panelId] + if (!Utils.isTabsPanel(dstPanel)) { + Logs.warn('Tabs.move: wrong type of target panel:', Utils.clone(dstPanel)) + return + } + } + // Move tabs from another window to this window if (src.windowId !== undefined && src.windowId !== Windows.id) { const tabIds = tabsInfo.map(t => t.id) @@ -86,7 +95,7 @@ export async function move( } // Gather tabs by type (pinned/normal), get initial info - const dstTab: Tab | undefined = Tabs.list[dst.index] + const dstTab = Tabs.list[dst.index] as Tab | undefined const dstParent = Tabs.byId[dst.parentId] const pinnedTabs: Tab[] = [] const normalTabs: Tab[] = [] @@ -103,6 +112,7 @@ export async function move( tabs.push(tab) } + if (dstTab?.pinned && !dst.pinned) return if (!tabs.length) return // Switch panelId of pinned tabs and exclude them from general list