浏览代码

Fix gui dispose when no ADT

David Catuhe 7 年之前
父节点
当前提交
4d5d40aedd
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      gui/src/2D/controls/control.ts

+ 5 - 3
gui/src/2D/controls/control.ts

@@ -1378,9 +1378,11 @@ export class Control {
             this._root = null;
         }
 
-        var index = this._host._linkedControls.indexOf(this);
-        if (index > -1) {
-            this.linkWithMesh(null);
+        if (this._host) {
+            var index = this._host._linkedControls.indexOf(this);
+            if (index > -1) {
+                this.linkWithMesh(null);
+            }
         }
     }