From 47e3d1ccb568da7bc7c4e0de340e6dad508bfe13 Mon Sep 17 00:00:00 2001
From: Mataes <mataes2007@gmail.com>
Date: Wed, 6 May 2020 22:51:26 +0300
Subject: newstory: clear time tree after deleting

---
 plugins/NewStory/src/history.cpp | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'plugins/NewStory/src')

diff --git a/plugins/NewStory/src/history.cpp b/plugins/NewStory/src/history.cpp
index ea0b5be5bd..8f825b3027 100644
--- a/plugins/NewStory/src/history.cpp
+++ b/plugins/NewStory/src/history.cpp
@@ -343,6 +343,10 @@ class CHistoryDlg : public CDlgBase
 
 		auto *pArray = (HistoryArray *)m_histControl.SendMsg(NSM_GETARRAY, 0, 0);
 		int numItems = pArray->getCount();
+		if (!numItems) {
+			m_timeTree.DeleteAllItems();
+			return;
+		}
 
 		int CurYear = 0, CurMonth = 0, CurDay = 0, PrevYear = -1, PrevMonth = -1, PrevDay = -1;
 		HTREEITEM hCurYear = 0, hCurMonth = 0, hCurDay = 0;
-- 
cgit v1.2.3