Quellcode durchsuchen

add check for undefined in set comments

Kyle Belfort vor 5 Jahren
Ursprung
Commit
cc6eea9c2c
1 geänderte Dateien mit 2 neuen und 3 gelöschten Zeilen
  1. 2 3
      nodeEditor/src/diagram/graphFrame.ts

+ 2 - 3
nodeEditor/src/diagram/graphFrame.ts

@@ -248,7 +248,7 @@ export class GraphFrame {
     }
 
     public set comments(comments: string) {
-        if (comments.length > 0) {
+        if (comments && comments.length > 0) {
             this.element.style.gridTemplateRows = "40px 40px calc(100% - 80px)";
             this._borderElement.style.gridRow = "1 / span 3";
             this._portContainer.style.gridRow = "3";
@@ -256,10 +256,9 @@ export class GraphFrame {
             this._commentsElement.style.gridRow = "2";
             this._commentsElement.style.gridColumn = "1";
             this._commentsElement.style.paddingLeft = "10px";
-            this._commentsElement.style.fontStyle = "italic";
+            this._commentsElement.innerText = comments;
         }
         this._comments = comments;
-        this._commentsElement.innerText = comments;
     }
 
     public constructor(candidate: Nullable<HTMLDivElement>, canvas: GraphCanvasComponent, doNotCaptureNodes = false) {