mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-10-13 16:03:43 +00:00
Add Null-check and return if null (#21556)
This commit is contained in:
parent
0995e5935c
commit
ca8c6d2f5d
@ -1105,14 +1105,17 @@ public class ProtobufSchemaCodegen extends DefaultCodegen implements CodegenConf
|
|||||||
addtionalPropertiesName = schema.getTitle();
|
addtionalPropertiesName = schema.getTitle();
|
||||||
} else {
|
} else {
|
||||||
Schema additionalProperties = ModelUtils.getAdditionalProperties(schema);
|
Schema additionalProperties = ModelUtils.getAdditionalProperties(schema);
|
||||||
if (additionalProperties.getTitle() != null) {
|
if(additionalProperties == null) {
|
||||||
|
return;
|
||||||
|
} else if (additionalProperties.getTitle() != null) {
|
||||||
addtionalPropertiesName = additionalProperties.getTitle();
|
addtionalPropertiesName = additionalProperties.getTitle();
|
||||||
} else if (additionalProperties.get$ref() != null) {
|
} else if (additionalProperties.get$ref() != null) {
|
||||||
String ref = ModelUtils.getSimpleRef(additionalProperties.get$ref());
|
String ref = ModelUtils.getSimpleRef(additionalProperties.get$ref());
|
||||||
addtionalPropertiesName = toVarName(toModelName(ref));
|
addtionalPropertiesName = toVarName(toModelName(ref));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
properties.put(addtionalPropertiesName, schema);
|
|
||||||
|
properties.put(addtionalPropertiesName, schema);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user