Skip to content

Commit

Permalink
fix: filter out nullish target elements before unlock
Browse files Browse the repository at this point in the history
  • Loading branch information
hustlelikeaboss authored and evinma committed Oct 24, 2024
1 parent 52cd177 commit f6faa37
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function unlock (targetElement?: Nullable<HTMLElement>, options?: BSLOpti
toArray(targetElement).forEach((element) => {
const index = lockState.lockedElements.indexOf(element)

if (index !== -1) {
if (element && index !== -1) {
element.ontouchmove = null
element.ontouchstart = null
lockState.lockedElements.splice(index, 1)
Expand Down

0 comments on commit f6faa37

Please sign in to comment.