fix NPE in R construct example (#15953)

This commit is contained in:
William Cheng 2023-06-30 09:29:33 +08:00 committed by GitHub
parent d5c53b9812
commit 15b3addd40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -945,10 +945,14 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
}
public String constructExampleCode(CodegenProperty codegenProperty, HashMap<String, CodegenModel> modelMaps, int depth) {
if (depth > 10) return "...";
if (depth > 10) {
return "...";
}
depth++;
if (codegenProperty.isArray) { // array
if (codegenProperty == null) {
return "TODO";
} else if (codegenProperty.isArray) { // array
return "c(" + constructExampleCode(codegenProperty.items, modelMaps, depth) + ")";
} else if (codegenProperty.isMap) { // map
return "c(key = " + constructExampleCode(codegenProperty.items, modelMaps, depth) + ")";