Use GrCustomStage to implement color matrix.

R=robertphillips@google.com
Review URL: https://codereview.appspot.com/6716044

git-svn-id: http://skia.googlecode.com/svn/trunk@5975 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 157d9bc..4df7a98 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -2020,10 +2020,12 @@
     GrDrawState* drawState = this->drawState();
     // FIXME: Assuming at most one texture per custom stage
     const GrCustomStage* customStage = drawState->sampler(stage)->getCustomStage();
-    GrGLTexture* nextTexture =  static_cast<GrGLTexture*>(customStage->texture(0));
-    if (NULL != nextTexture) {
-        const GrTextureParams& texParams = customStage->textureAccess(0).getParams();
-        this->flushBoundTextureAndParams(stage, texParams, nextTexture);
+    if (customStage->numTextures() > 0) {
+        GrGLTexture* nextTexture =  static_cast<GrGLTexture*>(customStage->texture(0));
+        if (NULL != nextTexture) {
+            const GrTextureParams& texParams = customStage->textureAccess(0).getParams();
+            this->flushBoundTextureAndParams(stage, texParams, nextTexture);
+        }
     }
 }