From 4913f4a75ea49463875a9398a20701bc1e4d4d37 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Tue, 15 Sep 2020 20:41:15 -0400
Subject: prevented last stack from being deleted in docking view.

---
 src/client/views/collections/CollectionDockingView.tsx | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'src/client/views/collections/CollectionDockingView.tsx')

diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index d7a134eb3..306b9187e 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -375,8 +375,12 @@ export class CollectionDockingView extends CollectionSubView(doc => doc) {
             .off('click') //unbind the current click handler
             .click(action(() => {
                 //if (confirm('really close this?')) {
-                stack.remove();
-                stack.contentItems.forEach((contentItem: any) => Doc.AddDocToList(CurrentUserUtils.MyRecentlyClosed, "data", contentItem.tab.DashDoc, undefined, true, true));
+                if (!stack.parent.parent.isRoot || stack.parent.contentItems.length > 1) {
+                    stack.remove();
+                    stack.contentItems.forEach((contentItem: any) => Doc.AddDocToList(CurrentUserUtils.MyRecentlyClosed, "data", contentItem.tab.DashDoc, undefined, true, true));
+                } else {
+                    alert('cant delete the last stack');
+                }
             }));
         stack.header?.controlsContainer.find('.lm_popout') //get the close icon
             .off('click') //unbind the current click handler
-- 
cgit v1.2.3-70-g09d2

