fix NPE in the C# Nancy generator (#1478)

This commit is contained in:
William Cheng 2018-11-17 23:11:14 +08:00 committed by Jim Schubert
parent c656194f22
commit 941b3ea015

View File

@ -285,6 +285,7 @@ public class CSharpNancyFXServerCodegen extends AbstractCSharpCodegen {
LOGGER.debug("Processing parents: " + parentModels); LOGGER.debug("Processing parents: " + parentModels);
for (final String parent : parentModels) { for (final String parent : parentModels) {
final CodegenModel parentModel = ModelUtils.getModelByName(parent, models); final CodegenModel parentModel = ModelUtils.getModelByName(parent, models);
if (parentModel != null) {
parentModel.hasChildren = true; parentModel.hasChildren = true;
final Collection<CodegenModel> childrenModels = childrenByParent.get(parent); final Collection<CodegenModel> childrenModels = childrenByParent.get(parent);
for (final CodegenModel child : childrenModels) { for (final CodegenModel child : childrenModels) {
@ -292,6 +293,7 @@ public class CSharpNancyFXServerCodegen extends AbstractCSharpCodegen {
} }
} }
} }
}
private void processParentPropertiesInChildModel(final CodegenModel parent, final CodegenModel child) { private void processParentPropertiesInChildModel(final CodegenModel parent, final CodegenModel child) {
final Map<String, CodegenProperty> childPropertiesByName = new HashMap<>(child.vars.size()); final Map<String, CodegenProperty> childPropertiesByName = new HashMap<>(child.vars.size());