From 83beddd55a39e6c4b5c82f3a259ae4e3f50ccaee Mon Sep 17 00:00:00 2001 From: MoyuScript Date: Thu, 3 Aug 2017 23:54:23 +0800 Subject: [PATCH] Allow image loads to fail without crashing render --- src/ImageLoader.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ImageLoader.js b/src/ImageLoader.js index e4c4e9c..7355623 100644 --- a/src/ImageLoader.js +++ b/src/ImageLoader.js @@ -83,7 +83,11 @@ export default class ImageLoader { ready(): Promise { const keys = Object.keys(this.cache); - return Promise.all(keys.map(str => this.cache[str])).then(images => { + return Promise.all(keys.map(str => this.cache[str].catch(e => { + if (__DEV__) { + this.logger.log(`Unable to load image`, e); + } + }))).then(images => { if (__DEV__) { this.logger.log('Finished loading images', images); }