Skip to content

Commit bfd8b39

Browse files
committed
fix: tabs: move: additional dst checks
1 parent 9635915 commit bfd8b39

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/services/tabs.fg.move.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ export async function move(
2626
if (dst.windowId === NOID) return
2727
}
2828

29+
// Check if target panel exists
30+
if (dst.panelId) {
31+
const dstPanel = Sidebar.panelsById[dst.panelId]
32+
if (!Utils.isTabsPanel(dstPanel)) {
33+
Logs.warn('Tabs.move: wrong type of target panel:', Utils.clone(dstPanel))
34+
return
35+
}
36+
}
37+
2938
// Move tabs from another window to this window
3039
if (src.windowId !== undefined && src.windowId !== Windows.id) {
3140
const tabIds = tabsInfo.map(t => t.id)
@@ -86,7 +95,7 @@ export async function move(
8695
}
8796

8897
// Gather tabs by type (pinned/normal), get initial info
89-
const dstTab: Tab | undefined = Tabs.list[dst.index]
98+
const dstTab = Tabs.list[dst.index] as Tab | undefined
9099
const dstParent = Tabs.byId[dst.parentId]
91100
const pinnedTabs: Tab[] = []
92101
const normalTabs: Tab[] = []
@@ -103,6 +112,7 @@ export async function move(
103112
tabs.push(tab)
104113
}
105114

115+
if (dstTab?.pinned && !dst.pinned) return
106116
if (!tabs.length) return
107117

108118
// Switch panelId of pinned tabs and exclude them from general list

0 commit comments

Comments
 (0)