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,10 +285,12 @@ public class CSharpNancyFXServerCodegen extends AbstractCSharpCodegen {
LOGGER.debug("Processing parents: " + parentModels);
for (final String parent : parentModels) {
final CodegenModel parentModel = ModelUtils.getModelByName(parent, models);
parentModel.hasChildren = true;
final Collection<CodegenModel> childrenModels = childrenByParent.get(parent);
for (final CodegenModel child : childrenModels) {
processParentPropertiesInChildModel(parentModel, child);
if (parentModel != null) {
parentModel.hasChildren = true;
final Collection<CodegenModel> childrenModels = childrenByParent.get(parent);
for (final CodegenModel child : childrenModels) {
processParentPropertiesInChildModel(parentModel, child);
}
}
}
}