From 7396fa07bf1334e02c0f682f742732935a5cd7ff Mon Sep 17 00:00:00 2001 From: pbakker Date: Mon, 18 Nov 2024 16:47:19 -0800 Subject: [PATCH] Add null check on sourcePreview from InvalidSyntaxException --- .../src/main/kotlin/com/netflix/graphql/dgs/codegen/CodeGen.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/CodeGen.kt b/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/CodeGen.kt index 4cb9ff85..cc7656eb 100644 --- a/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/CodeGen.kt +++ b/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/CodeGen.kt @@ -139,7 +139,7 @@ class CodeGen(private val config: CodeGenConfig) { parser.parseDocument(parserEnv) } catch (exception: InvalidSyntaxException) { // check if the schema is empty - if (exception.sourcePreview.isBlank()) { + if (exception.sourcePreview == null || exception.sourcePreview.isBlank()) { logger.warn("Schema is empty") // return an empty document return Document.newDocument().build()