From 9275f9750c314ba2f6b4d569a7d364ea053fa2e5 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Tue, 25 Apr 2023 19:28:17 +0800 Subject: [PATCH] - fix: Error message when save bookmarks. --- RedPandaIDE/debugger.cpp | 8 +++++++- RedPandaIDE/widgets/bookmarkmodel.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/RedPandaIDE/debugger.cpp b/RedPandaIDE/debugger.cpp index 21c83965..938d8be8 100644 --- a/RedPandaIDE/debugger.cpp +++ b/RedPandaIDE/debugger.cpp @@ -745,7 +745,13 @@ void Debugger::save(const QString &filename, const QString& projectFolder) foreach (const PWatchVar& watchVar, watchVars) { watchVarCompareSet.insert(watchVar->expression); } - std::shared_ptr pConfig = load(filename, forProject); + std::shared_ptr pConfig; + try { + pConfig = load(filename, forProject); + } catch (FileError& e) { + + } + QFile file(filename); if (file.open(QFile::WriteOnly | QFile::Truncate)) { foreach (const PBreakpoint& breakpoint, pConfig->breakpoints) { diff --git a/RedPandaIDE/widgets/bookmarkmodel.cpp b/RedPandaIDE/widgets/bookmarkmodel.cpp index 9c4271f7..8789307b 100644 --- a/RedPandaIDE/widgets/bookmarkmodel.cpp +++ b/RedPandaIDE/widgets/bookmarkmodel.cpp @@ -226,7 +226,13 @@ void BookmarkModel::save(const QString &filename, const QString& projectFolder) QString key = QString("%1-%2").arg(filename).arg(bookmark->line); compareHash.insert(key,i); } - QList fileBookmarks=load(filename, t,&fileTimestamp); + QList fileBookmarks; + try { + fileBookmarks=load(filename, t,&fileTimestamp); + } catch (FileError& e) { + + } + QFile file(filename); if (file.open(QFile::WriteOnly | QFile::Truncate)) {