Skip to content

Commit

Permalink
fix: check for undefined values
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisguttandin committed Apr 12, 2024
1 parent 8b4f969 commit 456b0b9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ export const deregister = async (port: MessagePort): Promise<void> => {
await drgstr(port);

const encoderRegex = ports.get(port);
const index = encoderRegexes.indexOf(encoderRegex);

encoderRegexes.splice(index, 1);
if (encoderRegex !== undefined) {
const index = encoderRegexes.indexOf(encoderRegex);

encoderRegexes.splice(index, 1);
}
};

export const isSupported = () => createIsSupportedPromise(window);
Expand Down

0 comments on commit 456b0b9

Please sign in to comment.