aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PictureTest.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-09 16:04:32 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-09 16:04:32 +0000
commitfe433c13705bc626b67198097109984ce851d437 (patch)
tree7156a229332e4c045f309617b7c0c6e79c9a122e /tests/PictureTest.cpp
parent468142b2f50de055f00d5684515d962777da5131 (diff)
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
Diffstat (limited to 'tests/PictureTest.cpp')
-rw-r--r--tests/PictureTest.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index 49bc57b1af..1827fdcb5a 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -189,9 +189,11 @@ static void test_gatherpixelrefs(skiatest::Reporter* reporter) {
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