Skip to content

Commit 1c3df14

Browse files
committed
fix: the right-click menu was corrupted by v2.2.0 (#43)
1 parent c8d0f42 commit 1c3df14

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/background/index.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ Browser.commands.onCommand.addListener(async (command) => {
159159
useMenuPosition: false,
160160
}
161161
console.debug('command triggered', message)
162-
if (menuConfig[command].action) menuConfig[command].action()
162+
if (command in menuConfig && menuConfig[command].action) menuConfig[command].action()
163163
Browser.tabs.sendMessage(currentTab.id, {
164164
type: 'CREATE_CHAT',
165165
data: message,
@@ -212,7 +212,8 @@ function refreshMenu() {
212212
useMenuPosition: tab.id === currentTab.id,
213213
}
214214
console.debug('menu clicked', message)
215-
if (menuConfig[message.itemId].action) menuConfig[message.itemId].action()
215+
if (message.itemId in menuConfig && menuConfig[message.itemId].action)
216+
menuConfig[message.itemId].action()
216217
Browser.tabs.sendMessage(currentTab.id, {
217218
type: 'CREATE_CHAT',
218219
data: message,

0 commit comments

Comments
 (0)