From 21a29592c0b749f3feb028ccf756085f4bec2365 Mon Sep 17 00:00:00 2001 From: Ciaran Treanor Date: Tue, 16 Oct 2018 18:55:46 +0100 Subject: [PATCH] Avoid error from 'jhipster info' if entity has no relationships. --- lib/converters/json_to_jdl_entity_converter.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/converters/json_to_jdl_entity_converter.js b/lib/converters/json_to_jdl_entity_converter.js index 8c5cd62b..4f24952f 100644 --- a/lib/converters/json_to_jdl_entity_converter.js +++ b/lib/converters/json_to_jdl_entity_converter.js @@ -169,12 +169,14 @@ function addRelationshipsToJDL() { } function dealWithRelationships(relationships, entityName) { - relationships.forEach(relationship => { - const jdlRelationship = getRelationship(relationship, entityName); - if (jdlRelationship) { - configuration.jdl.addRelationship(jdlRelationship); - } - }); + if (relationships !== undefined) { + relationships.forEach(relationship => { + const jdlRelationship = getRelationship(relationship, entityName); + if (jdlRelationship) { + configuration.jdl.addRelationship(jdlRelationship); + } + }); + } } function getRelationship(relationship, entityName) {