Handle failed surface creation in AlphaThresholdImageFilter GM
authorRobert Phillips <robertphillips@google.com>
Wed, 21 Dec 2016 00:05:09 +0000 (19:05 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Wed, 21 Dec 2016 02:06:15 +0000 (02:06 +0000)
Change-Id: Ibc27d26a9afc1f88d5ca7de2216e09afa10ce846
Reviewed-on: https://skia-review.googlesource.com/6354
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>

gm/imagealphathreshold.cpp

index 302cdee..193423d 100644 (file)
@@ -131,6 +131,9 @@ protected:
 
         sk_sp<SkSurface> surface(make_color_matching_surface(canvas, WIDTH, HEIGHT,
                                                              kPremul_SkAlphaType));
+        if (!surface) {
+            return;
+        }
 
         surface->getCanvas()->clear(SK_ColorTRANSPARENT);
         draw_rects(surface->getCanvas());