Guard against instantiate & accessRenderTarget failures

Chrome's fuzzer have reminded me that, since we are deferring allocation, instantiate and accessRenderTarget can now fail further down the call stack.

This should probably be cherry picked back to M56.

BUG=665681,665500,665621

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4929

Change-Id: I44d81ff29586dfe75ddda30b5ed8ca76354542d6
Reviewed-on: https://skia-review.googlesource.com/4929
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 133c4f7..072f41c 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -356,6 +356,9 @@
     }
 
     GrRenderTarget* rt = renderTargetContext->accessRenderTarget();
+    if (!rt) {
+        return true;
+    }
 
     // use the stencil clip if we can't represent the clip as a rectangle.
     if (!context->resourceProvider()->attachStencilAttachment(rt)) {
@@ -413,7 +416,10 @@
     }
 
     sk_sp<GrTexture> texture(rtc->asTexture());
-    SkASSERT(texture);
+    if (!texture) {
+        return nullptr;
+    }
+
     texture->resourcePriv().setUniqueKey(key);
     return texture;
 }