瀏覽代碼

Fix error on closing the last tab

Leonardo Jeanteur 1 年之前
父節點
當前提交
99dedb8bb5
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      bin/libs/goldenlayout.js

+ 2 - 2
bin/libs/goldenlayout.js

@@ -4404,9 +4404,9 @@ lm.utils.copy( lm.items.Stack.prototype, {
 		lm.items.AbstractContentItem.prototype.removeChild.call( this, contentItem, keepChild );
 		lm.items.AbstractContentItem.prototype.removeChild.call( this, contentItem, keepChild );
 		this.header.removeTab( contentItem );
 		this.header.removeTab( contentItem );
 
 
-		if( activeIndex === index ) {
+		if( activeIndex === index && this.contentItems.length > 0 ) {
 			this.setActiveContentItem( this.contentItems[ Math.max( index - 1, 0 ) ] );
 			this.setActiveContentItem( this.contentItems[ Math.max( index - 1, 0 ) ] );
-		} else if( this.contentItems.length <= 0 ) {
+		} else {
 			this._activeContentItem = null;
 			this._activeContentItem = null;
 		}
 		}