Fix: don't swallow error

main
Isaiah Odhner 2021-02-12 19:27:34 -05:00
parent aef5267361
commit 545120e9a6
1 changed files with 7 additions and 2 deletions

View File

@ -545,8 +545,13 @@ function load_image_from_uri(uri, callback){
let index = 0;
const try_next_uri = (last_uri_error)=> {
if (last_uri_error && fails.length < index) {
fails.push({url: uris_to_try[index-1]});
if (last_uri_error) {
if (!fails[0] || !fails[index-1].url) {
throw last_uri_error;
}
if (fails.length < index) {
fails.push({url: uris_to_try[index-1]});
}
}
const index_to_try = index;