diff options
author | Leon Scroggins III <scroggo@google.com> | 2017-01-30 09:59:28 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-30 16:41:47 +0000 |
commit | c9942a15fa781dd265f7baf93211dab6fdbd8312 (patch) | |
tree | 69123eb9584d0f386212a78a5b57bcfb1180e3b4 | |
parent | 3de0aee181b8fe0013b15100cba7381eb0468db4 (diff) |
Do not crash when the resources are missing
In test_conversion_possible
BUG=skia:5314
Change-Id: Ia0e4178a262820b4161e55e07b0669f18322a64b
Reviewed-on: https://skia-review.googlesource.com/7742
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
-rw-r--r-- | tests/CodecTest.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/CodecTest.cpp b/tests/CodecTest.cpp index 1ef71b32ad..4083cfa44b 100644 --- a/tests/CodecTest.cpp +++ b/tests/CodecTest.cpp @@ -1186,7 +1186,16 @@ static void test_conversion_possible(skiatest::Reporter* r, const char* path, bool supportsScanlineDecoder, bool supportsIncrementalDecoder) { std::unique_ptr<SkStream> stream(GetResourceAsStream(path)); + if (!stream) { + return; + } + std::unique_ptr<SkCodec> codec(SkCodec::NewFromStream(stream.release())); + if (!codec) { + ERRORF(r, "failed to create a codec for %s", path); + return; + } + SkImageInfo infoF16 = codec->getInfo().makeColorType(kRGBA_F16_SkColorType); SkBitmap bm; |