Fix 'Fail to import service with CP'-bug
[sdc.git] / catalog-ui / src / app / utils / service-csar-reader.ts
index 20dfe6c..4c9b0cd 100644 (file)
@@ -82,7 +82,10 @@ export class ServiceCsarReader {
     }
 
     private readSubstitutionNodeFromMainTemplateFile(entryDefinitionFileContent) {
-        this.serviceCsar.substitutionNodeType = load(entryDefinitionFileContent).topology_template.substitution_mappings.node_type;
+        const loadEntryDefinitionFileContent = load(entryDefinitionFileContent);
+        if (loadEntryDefinitionFileContent.topology_template && loadEntryDefinitionFileContent.topology_template.substitution_mappings) {
+            this.serviceCsar.substitutionNodeType = loadEntryDefinitionFileContent.topology_template.substitution_mappings.node_type;
+        }
     }
 
     private setMetadata = (metadata:object) : void => {
@@ -147,4 +150,4 @@ export class ServiceCsarReader {
         });
         this.serviceCsar.extraServiceMetadata = extraServiceMetadata;
     }
-}
\ No newline at end of file
+}