aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/CodecTest.cpp
diff options
context:
space:
mode:
authorGravatar Leon Scroggins III <scroggo@google.com>2017-01-30 09:59:28 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-30 16:41:47 +0000
commitc9942a15fa781dd265f7baf93211dab6fdbd8312 (patch)
tree69123eb9584d0f386212a78a5b57bcfb1180e3b4 /tests/CodecTest.cpp
parent3de0aee181b8fe0013b15100cba7381eb0468db4 (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>
Diffstat (limited to 'tests/CodecTest.cpp')
-rw-r--r--tests/CodecTest.cpp9
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;