From fc3ad7def194ae449c7e5cff5b0f5cbc9ba93b61 Mon Sep 17 00:00:00 2001 From: George Wright Date: Wed, 25 Jul 2012 20:11:17 -0400 Subject: [PATCH] Bug 774728 - Do a null pointer check before using any gradient shaders in DrawTargetSkia r=mattwoodrow --HG-- extra : rebase_source : 7db2d28692a3cd9cccbd542ca752950f5df90511 --- gfx/2d/DrawTargetSkia.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/gfx/2d/DrawTargetSkia.cpp b/gfx/2d/DrawTargetSkia.cpp index 5fa324445322..8042f1c60b03 100644 --- a/gfx/2d/DrawTargetSkia.cpp +++ b/gfx/2d/DrawTargetSkia.cpp @@ -206,10 +206,14 @@ void SetPaintPattern(SkPaint& aPaint, const Pattern& aPattern, Float aAlpha = 1. &stops->mPositions.front(), stops->mCount, mode); - SkMatrix mat; - GfxMatrixToSkiaMatrix(pat.mMatrix, mat); - shader->setLocalMatrix(mat); - SkSafeUnref(aPaint.setShader(shader)); + + if (shader) { + SkMatrix mat; + GfxMatrixToSkiaMatrix(pat.mMatrix, mat); + shader->setLocalMatrix(mat); + SkSafeUnref(aPaint.setShader(shader)); + } + } else { aPaint.setColor(SkColorSetARGB(0, 0, 0, 0)); } @@ -233,10 +237,13 @@ void SetPaintPattern(SkPaint& aPaint, const Pattern& aPattern, Float aAlpha = 1. &stops->mPositions.front(), stops->mCount, mode); - SkMatrix mat; - GfxMatrixToSkiaMatrix(pat.mMatrix, mat); - shader->setLocalMatrix(mat); - SkSafeUnref(aPaint.setShader(shader)); + if (shader) { + SkMatrix mat; + GfxMatrixToSkiaMatrix(pat.mMatrix, mat); + shader->setLocalMatrix(mat); + SkSafeUnref(aPaint.setShader(shader)); + } + } else { aPaint.setColor(SkColorSetARGB(0, 0, 0, 0)); }