From 0784fd43f3dc6372c38a9b54c3fbaf8d90c8ddc5 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Thu, 29 Jul 2021 21:03:31 +0800 Subject: [PATCH] fix history loading issue of notebook --- src/core/historymgr.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/core/historymgr.cpp b/src/core/historymgr.cpp index 875061bf..c25270d9 100644 --- a/src/core/historymgr.cpp +++ b/src/core/historymgr.cpp @@ -9,6 +9,7 @@ #include "notebookmgr.h" #include #include +#include "exception.h" using namespace vnotex; @@ -64,7 +65,15 @@ void HistoryMgr::loadHistory() for (const auto &item : history) { auto fullItem = QSharedPointer::create(); fullItem->m_item = item; - fullItem->m_item.m_path = backend->getFullPath(item.m_path); + + // We saved the absolute path by mistake in previous version. + try { + fullItem->m_item.m_path = backend->getFullPath(item.m_path); + } catch (Exception &p_e) { + qWarning() << "skipped loading history item" << item.m_path << "from notebook" << nb->getName() << p_e.what(); + continue; + } + fullItem->m_notebookName = nb->getName(); m_history.push_back(fullItem); }