Make sure we are checking for failed wrapping of semaphores.

Bug: chromium:1098902
Change-Id: I338464b6364b3e0f614e8e084a2b0382b3b975e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300258
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/gpu/GrWaitRenderTask.cpp b/src/gpu/GrWaitRenderTask.cpp
index 4b3855b..d974030 100644
--- a/src/gpu/GrWaitRenderTask.cpp
+++ b/src/gpu/GrWaitRenderTask.cpp
@@ -24,7 +24,12 @@
 
 bool GrWaitRenderTask::onExecute(GrOpFlushState* flushState) {
     for (int i = 0; i < fNumSemaphores; ++i) {
-        flushState->gpu()->waitSemaphore(fSemaphores[i].get());
+        // If we don't have a semaphore here it means we failed to wrap it. That happens if the
+        // client didn't give us a valid semaphore to begin with. Therefore, it is fine to not wait
+        // on it.
+        if (fSemaphores[i].get()) {
+            flushState->gpu()->waitSemaphore(fSemaphores[i].get());
+        }
     }
     return true;
 }