Skip to content

Commit ea030fd

Browse files
fix: #382 prevent network calls for the falsy/undefined src values inside isImageValid (#383)
1 parent d4684be commit ea030fd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/util.ts

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
export function isImageValid(src: string) {
22
return new Promise(resolve => {
3+
if (!src) {
4+
resolve(false);
5+
return;
6+
}
37
const img = document.createElement('img');
48
img.onerror = () => resolve(false);
59
img.onload = () => resolve(true);

0 commit comments

Comments
 (0)