From 388b84eda418334194af2914ea9af659711273c0 Mon Sep 17 00:00:00 2001 From: mclacore Date: Wed, 27 Nov 2024 09:58:12 -0800 Subject: [PATCH] Fix seg fault when node.Items is nil --- pkg/opentofu/schematotofu.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/opentofu/schematotofu.go b/pkg/opentofu/schematotofu.go index 1196bde..6aee89e 100644 --- a/pkg/opentofu/schematotofu.go +++ b/pkg/opentofu/schematotofu.go @@ -83,7 +83,10 @@ func typeExprTokens(node *schema.Schema, optional bool) hclwrite.Tokens { } func convertArray(node *schema.Schema) hclwrite.Tokens { - return hclwrite.TokensForFunctionCall("list", typeExprTokens(node.Items, false)) + if node.Items != nil { + return hclwrite.TokensForFunctionCall("list", typeExprTokens(node.Items, false)) + } + return hclwrite.TokensForFunctionCall("list", hclwrite.TokensForIdentifier("any")) } func convertMap(node *schema.Schema) hclwrite.Tokens {