Skip to content

Commit e793f35

Browse files
committed
fixed NPE on adding content type extension
1 parent 88c0804 commit e793f35

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3770,7 +3770,9 @@ protected Schema getSchemaFromResponse(ApiResponse response) {
37703770
Schema schema = null;
37713771
for (String contentType : response.getContent().keySet()) {
37723772
schema = response.getContent().get(contentType).getSchema();
3773-
schema.addExtension("x-content-type", contentType);
3773+
if (schema != null) {
3774+
schema.addExtension("x-content-type", contentType);
3775+
}
37743776
break;
37753777
}
37763778
return schema;

0 commit comments

Comments
 (0)