Skip to content

Commit

Permalink
Handle unexpected RuntimeExceptions in DecodePath.
Browse files Browse the repository at this point in the history
Some decoders will throw randomly, that doesn’t mean that we can’t 
continue on to try other decoders. 

Fixes #2406.
  • Loading branch information
sjudd committed Sep 19, 2017
1 parent 8058e17 commit 6cffaab
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ private Resource<ResourceType> decodeResourceWithList(DataRewinder<DataType> rew
data = rewinder.rewindAndGet();
result = decoder.decode(data, width, height, options);
}
} catch (IOException e) {
// Some decoders throw unexpectedly. If they do, we shouldn't fail the entire load path, but
// instead log and continue. See #2406 for an example.
} catch (IOException | RuntimeException e) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "Failed to decode data for " + decoder, e);
}
Expand Down

0 comments on commit 6cffaab

Please sign in to comment.