Skip to content

Commit ca8c6d2

Browse files
Add Null-check and return if null (#21556)
1 parent 0995e59 commit ca8c6d2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ProtobufSchemaCodegen.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,14 +1105,17 @@ protected void addProperties(Map<String, Schema> properties, List<String> requir
11051105
addtionalPropertiesName = schema.getTitle();
11061106
} else {
11071107
Schema additionalProperties = ModelUtils.getAdditionalProperties(schema);
1108-
if (additionalProperties.getTitle() != null) {
1108+
if(additionalProperties == null) {
1109+
return;
1110+
} else if (additionalProperties.getTitle() != null) {
11091111
addtionalPropertiesName = additionalProperties.getTitle();
11101112
} else if (additionalProperties.get$ref() != null) {
11111113
String ref = ModelUtils.getSimpleRef(additionalProperties.get$ref());
11121114
addtionalPropertiesName = toVarName(toModelName(ref));
11131115
}
11141116
}
1115-
properties.put(addtionalPropertiesName, schema);
1117+
1118+
properties.put(addtionalPropertiesName, schema);
11161119
}
11171120
}
11181121
}

0 commit comments

Comments
 (0)