Only dereference imgcfg if non-null

Bug: oss-fuzz:8902
Change-Id: I2cd6fff4e27cc75f324f04888bcc36a42c912726
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203165
Auto-Submit: Leon Scroggins <scroggo@google.com>
Reviewed-by: Nigel Tao <nigeltao@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
diff --git a/src/codec/SkWuffsCodec.cpp b/src/codec/SkWuffsCodec.cpp
index 585c51b7..2a8c984 100644
--- a/src/codec/SkWuffsCodec.cpp
+++ b/src/codec/SkWuffsCodec.cpp
@@ -790,8 +790,10 @@
         default:
             return SkCodec::kInternalError;
     }
-    imgcfg->pixcfg.set(pixfmt, WUFFS_BASE__PIXEL_SUBSAMPLING__NONE, imgcfg->pixcfg.width(),
-                       imgcfg->pixcfg.height());
+    if (imgcfg) {
+        imgcfg->pixcfg.set(pixfmt, WUFFS_BASE__PIXEL_SUBSAMPLING__NONE, imgcfg->pixcfg.width(),
+                           imgcfg->pixcfg.height());
+    }
 
     return SkCodec::kSuccess;
 }