Closed pkaminski closed 7 years ago
@pkaminski That's highly likely the getAsFile()
API is yielding null
(that means maybe an invalid image, or a very big image failed to be process by Chrome), since the version is almost the latest.
But sure I'm adding a try catch to make it less exception-ish.
so okay, that's my way, it's worked
const _handleImageChange = (event) => {
let file = event.target.files[0]
if (file) {
let reader = new FileReader()
reader.onloadend = () => {
setImagePreviewUrl(reader.result)
}
reader.readAsDataURL(file)
}
}
A user got this error while using paste.js 0.0.21 within Reviewable:
This is in Chrome 56.0.2924 on Mac OS X 10.12.2. I don't know what they were trying to paste -- presumably something that's not supported -- but it's probably worth it to stick a try/catch around this line just in case.