Skip to content

Commit

Permalink
fix: chooseFile
Browse files Browse the repository at this point in the history
  • Loading branch information
fjc0k committed Sep 29, 2024
1 parent 7e51af5 commit b75bbec
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/utils/chooseFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ export function chooseFile(
const handleChange = () => {
unbindChange()
unbindBlur()
const files = input.files || []
document.body.removeChild(input)
input = null as any
resolve(Object.freeze(toArray(files)))
if (input) {
const files = input.files || []
document.body.removeChild(input)
input = null as any
resolve(Object.freeze(toArray(files)))
}
}
const unbindChange = bindEvent(input)('change', handleChange)
const unbindBlur = bindEvent(input)('blur', handleChange)
Expand Down

0 comments on commit b75bbec

Please sign in to comment.