From 56fde5c8d79ad3aba58ca869ac23f8bb329821ea Mon Sep 17 00:00:00 2001 From: Mathieu Chauvet Date: Tue, 6 Feb 2024 02:34:08 +0100 Subject: [PATCH] Update operation.go (#1753) getUnderlyingSchema can return nil, so it has to be checked here otherwise the code is exposed to invalid memory address or nil pointer dereference --- operation.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/operation.go b/operation.go index 169510ffc..10c724f65 100644 --- a/operation.go +++ b/operation.go @@ -334,6 +334,9 @@ func (operation *Operation) ParseParamComment(commentLine string, astFile *ast.F if len(itemSchema.Type) == 0 { itemSchema = operation.parser.getUnderlyingSchema(prop.Items.Schema) } + if itemSchema == nil { + continue + } if len(itemSchema.Type) == 0 { continue }