Index: tests/ImageTest.cpp |
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp |
index e53d14222c7273a66c50afd512c6a7a2760fb21c..993c3fa0f20da04f2368a62f8e729516483291ba 100644 |
--- a/tests/ImageTest.cpp |
+++ b/tests/ImageTest.cpp |
@@ -171,6 +171,10 @@ static void test_encode(skiatest::Reporter* reporter, SkImage* image) { |
REPORTER_ASSERT(reporter, origEncoded->size() > 0); |
sk_sp<SkImage> decoded(SkImage::MakeFromEncoded(origEncoded)); |
+ if (!decoded) { |
+ ERRORF(reporter, "failed to decode image!"); |
+ return; |
+ } |
REPORTER_ASSERT(reporter, decoded); |
assert_equal(reporter, image, nullptr, decoded.get()); |
@@ -599,6 +603,10 @@ static bool has_pixels(const SkPMColor pixels[], int count, SkPMColor expected) |
} |
static void test_read_pixels(skiatest::Reporter* reporter, SkImage* image) { |
+ if (!image) { |
+ ERRORF(reporter, "Failed to create image!"); |
+ return; |
+ } |
const SkPMColor expected = SkPreMultiplyColor(SK_ColorWHITE); |
const SkPMColor notExpected = ~expected; |
@@ -684,6 +692,10 @@ static void check_legacy_bitmap(skiatest::Reporter* reporter, const SkImage* ima |
} |
static void test_legacy_bitmap(skiatest::Reporter* reporter, const SkImage* image, SkImage::LegacyBitmapMode mode) { |
+ if (!image) { |
+ ERRORF(reporter, "Failed to create image."); |
+ return; |
+ } |
SkBitmap bitmap; |
REPORTER_ASSERT(reporter, image->asLegacyBitmap(&bitmap, mode)); |
check_legacy_bitmap(reporter, image, bitmap, mode); |
@@ -735,6 +747,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageLegacyBitmap_Gpu, reporter, ctxInfo) { |
#endif |
static void test_peek(skiatest::Reporter* reporter, SkImage* image, bool expectPeekSuccess) { |
+ if (!image) { |
+ ERRORF(reporter, "Failed to create image!"); |
+ return; |
+ } |
SkPixmap pm; |
bool success = image->peekPixels(&pm); |
REPORTER_ASSERT(reporter, expectPeekSuccess == success); |
@@ -926,6 +942,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredTextureImage, reporter, ctxInfo) { |
for (auto testCase : testCases) { |
sk_sp<SkImage> image(testCase.fImageFactory()); |
+ if (!image) { |
+ ERRORF(reporter, "Failed to create image!"); |
+ continue; |
+ } |
+ |
size_t size = image->getDeferredTextureImageData(*proxy, testCase.fParams.data(), |
static_cast<int>(testCase.fParams.size()), |
nullptr, SkSourceGammaTreatment::kIgnore); |