Browse Source

if no template was provided, don't init "main"

Raanan Weber 7 years ago
parent
commit
dc6b70a892
1 changed files with 9 additions and 4 deletions
  1. 9 4
      Viewer/src/templateManager.ts

+ 9 - 4
Viewer/src/templateManager.ts

@@ -89,8 +89,12 @@ export class TemplateManager {
         }
 
         //build the html tree
-        this.buildHTMLTree(templates).then(htmlTree => {
-            internalInit(htmlTree, 'main');
+        return this.buildHTMLTree(templates).then(htmlTree => {
+            if (this.templates['main']) {
+                internalInit(htmlTree, 'main');
+                return true;
+            }
+            return false;
         });
     }
 
@@ -123,8 +127,9 @@ export class TemplateManager {
                     buildTree(parentObject[element], element);
                 });
             }
-
-            buildTree(templateStructure, "main");
+            if (this.templates['main']) {
+                buildTree(templateStructure, "main");
+            }
             return templateStructure;
         });
     }