From 080bfcffbc9ca9089d0dde591e03640cfe886f0b Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 15 Apr 2023 12:35:30 +0100 Subject: [PATCH] Corrected failed assertion in restore and delete snapshot functions in the SnapshotManager --- .../SnapshotManager/SnapshotManager.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotManager.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotManager.cpp index dcf60acc..f924d9f2 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotManager.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotManager.cpp @@ -262,7 +262,9 @@ namespace Bloom::Widgets if (snapshotViewerIt == this->snapshotViewersById.end()) { const auto& snapshotIt = this->snapshotsById.find(snapshotId); - assert(snapshotIt != this->snapshotsById.end()); + if (snapshotIt == this->snapshotsById.end()) { + return; + } snapshotViewerIt = this->snapshotViewersById.insert( snapshotId, @@ -277,7 +279,11 @@ namespace Bloom::Widgets void SnapshotManager::deleteSnapshot(const QString& snapshotId, bool confirmationPromptEnabled) { const auto& snapshotIt = this->snapshotsById.find(snapshotId); - assert(snapshotIt != this->snapshotsById.end()); + + if (snapshotIt == this->snapshotsById.end()) { + return; + } + const auto& snapshot = snapshotIt.value(); if (confirmationPromptEnabled) { @@ -349,7 +355,11 @@ namespace Bloom::Widgets void SnapshotManager::restoreSnapshot(const QString& snapshotId, bool confirmationPromptEnabled) { const auto& snapshotIt = this->snapshotsById.find(snapshotId); - assert(snapshotIt != this->snapshotsById.end()); + + if (snapshotIt == this->snapshotsById.end()) { + return; + } + const auto& snapshot = snapshotIt.value(); if (confirmationPromptEnabled) {