Handle null GrDirectContext in DDL Fuzzer

Bug: oss-fuzz:24449
Change-Id: I379e12ef12d45d4959db72ce90ebeaf1d1933623
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307221
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/fuzz/FuzzCreateDDL.cpp b/fuzz/FuzzCreateDDL.cpp
index 299c936..be44d20 100644
--- a/fuzz/FuzzCreateDDL.cpp
+++ b/fuzz/FuzzCreateDDL.cpp
@@ -206,10 +206,15 @@
     GrSurfaceOrigin origin;
     fuzz->nextEnum(&surfaceType, SkColorType::kLastEnum_SkColorType);
     fuzz->nextEnum(&origin, GrSurfaceOrigin::kTopLeft_GrSurfaceOrigin);
+
     sk_gpu_test::GrContextFactory factory;
-    sk_gpu_test::ContextInfo ctxInfo = factory.getContextInfo(
-        factory.ContextType::kGL_ContextType);
+    auto ctxInfo = factory.getContextInfo(sk_gpu_test::GrContextFactory::kGL_ContextType);
+
     GrDirectContext* dContext = ctxInfo.directContext();
+    if (!dContext) {
+        SkDebugf("Context creation failed");
+        return;
+    }
 
     auto[surface, c] = create_surface_and_characterization(fuzz, dContext, surfaceType, origin);
     if (!surface || !c.isValid()) {