Explorar o código

Merge pull request #7573 from belfortk/set-frames-comments-undefined

Fix for bug where NME would crash if frames did not have comments
David Catuhe %!s(int64=5) %!d(string=hai) anos
pai
achega
f76777e2c6
Modificáronse 2 ficheiros con 3 adicións e 2 borrados
  1. 1 0
      dist/preview release/what's new.md
  2. 2 2
      nodeEditor/src/diagram/graphFrame.ts

+ 1 - 0
dist/preview release/what's new.md

@@ -315,6 +315,7 @@
 - Fixed bug in the `ScrollViewer` GUI class when setting a `idealWidth` or `idealHeight` on the ADT ([Popov72](https://github.com/Popov72))
 - Fixed bug in the `Image` GUI class where some properties were lost after a rotation by n x 90° ([Popov72](https://github.com/Popov72))
 - Fixed bug in the `Image` GUI class when rotating a SVG picture ([Popov72](https://github.com/Popov72))
+- Fix for bug where NME would crash if frames did not have comments ([Kyle Belfort](https://github.com/belfortk))
 
 ## Breaking changes
 

+ 2 - 2
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";
@@ -257,9 +257,9 @@ export class GraphFrame {
             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) {