Skip to content

Commit

Permalink
Fix unhandled rejection "EncodingError: The source image cannot be de…
Browse files Browse the repository at this point in the history
  • Loading branch information
mishchuk committed Oct 21, 2022
1 parent 42b6272 commit ee629a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/js/slide/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ class Content {
// purposefully using finally instead of then,
// as if srcset sizes changes dynamically - it may cause decode error
/** @type {HTMLImageElement} */
(this.element).decode().finally(() => {
(this.element).decode().catch(() => {}).finally(() => {
this.isDecoding = false;
this.appendImage();
});
Expand Down
2 changes: 1 addition & 1 deletion src/js/util/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export function removeTransitionStyle(el) {
*/
export function decodeImage(img) {
if ('decode' in img) {
return img.decode();
return img.decode().catch(() => {});
}

if (img.complete) {
Expand Down

0 comments on commit ee629a1

Please sign in to comment.