From a0282d34ecbf8b5bd9ae38233d688880ee6eb34a Mon Sep 17 00:00:00 2001 From: Roger Date: Fri, 3 Jul 2020 23:17:33 -0400 Subject: [PATCH] Fix support for image-less blog posts (#1525) --- src/gatsby/utils/resolvers/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gatsby/utils/resolvers/index.js b/src/gatsby/utils/resolvers/index.js index 0641a77aad..1338a8c297 100644 --- a/src/gatsby/utils/resolvers/index.js +++ b/src/gatsby/utils/resolvers/index.js @@ -29,6 +29,9 @@ function sourcePathResolver({ return async function resolveBySourcePath(source, args, context, info) { const fieldValue = context.defaultFieldResolver(source, args, context, info) + // Bail out early with null if no value was provided + if (!fieldValue) return null + // Allow for callers to provide a function that modifies the field value into // the actual relative path of a file. const sourcePath = resolvePath ? resolvePath(fieldValue) : fieldValue