Skip to content

Commit 23875f7

Browse files
authored
Merge pull request #330 from swagger-api/issue-329
fixed NPE on adding content type extension
2 parents 88c0804 + e793f35 commit 23875f7

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)