When gather pixel refs was broken, REPORTER_ASSERT(data) realized that data was NULL, but subsequent lines dereferenced it anyway, and so segfaulted.
R=reed@google.com, tomhudson@google.com
Author: tomhudson@chromium.org
Review URL: https://chromiumcodereview.appspot.com/18904003
git-svn-id: http://skia.googlecode.com/svn/trunk@9933 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index 49bc57b..1827fdc 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -189,9 +189,11 @@
r.offset(pos[i].fX, pos[i].fY);
SkAutoDataUnref data(SkPictureUtils::GatherPixelRefs(pic, r));
REPORTER_ASSERT(reporter, data);
- int count = data->size() / sizeof(SkPixelRef*);
- REPORTER_ASSERT(reporter, 1 == count);
- REPORTER_ASSERT(reporter, *(SkPixelRef**)data->data() == refs[i]);
+ if (data) {
+ int count = data->size() / sizeof(SkPixelRef*);
+ REPORTER_ASSERT(reporter, 1 == count);
+ REPORTER_ASSERT(reporter, *(SkPixelRef**)data->data() == refs[i]);
+ }
}
// Test a bunch of random (mostly) rects, and compare the gather results