Corrected failed assertion in restore and delete snapshot functions in the SnapshotManager
This commit is contained in:
@@ -262,7 +262,9 @@ namespace Bloom::Widgets
|
|||||||
if (snapshotViewerIt == this->snapshotViewersById.end()) {
|
if (snapshotViewerIt == this->snapshotViewersById.end()) {
|
||||||
const auto& snapshotIt = this->snapshotsById.find(snapshotId);
|
const auto& snapshotIt = this->snapshotsById.find(snapshotId);
|
||||||
|
|
||||||
assert(snapshotIt != this->snapshotsById.end());
|
if (snapshotIt == this->snapshotsById.end()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
snapshotViewerIt = this->snapshotViewersById.insert(
|
snapshotViewerIt = this->snapshotViewersById.insert(
|
||||||
snapshotId,
|
snapshotId,
|
||||||
@@ -277,7 +279,11 @@ namespace Bloom::Widgets
|
|||||||
|
|
||||||
void SnapshotManager::deleteSnapshot(const QString& snapshotId, bool confirmationPromptEnabled) {
|
void SnapshotManager::deleteSnapshot(const QString& snapshotId, bool confirmationPromptEnabled) {
|
||||||
const auto& snapshotIt = this->snapshotsById.find(snapshotId);
|
const auto& snapshotIt = this->snapshotsById.find(snapshotId);
|
||||||
assert(snapshotIt != this->snapshotsById.end());
|
|
||||||
|
if (snapshotIt == this->snapshotsById.end()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const auto& snapshot = snapshotIt.value();
|
const auto& snapshot = snapshotIt.value();
|
||||||
|
|
||||||
if (confirmationPromptEnabled) {
|
if (confirmationPromptEnabled) {
|
||||||
@@ -349,7 +355,11 @@ namespace Bloom::Widgets
|
|||||||
|
|
||||||
void SnapshotManager::restoreSnapshot(const QString& snapshotId, bool confirmationPromptEnabled) {
|
void SnapshotManager::restoreSnapshot(const QString& snapshotId, bool confirmationPromptEnabled) {
|
||||||
const auto& snapshotIt = this->snapshotsById.find(snapshotId);
|
const auto& snapshotIt = this->snapshotsById.find(snapshotId);
|
||||||
assert(snapshotIt != this->snapshotsById.end());
|
|
||||||
|
if (snapshotIt == this->snapshotsById.end()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const auto& snapshot = snapshotIt.value();
|
const auto& snapshot = snapshotIt.value();
|
||||||
|
|
||||||
if (confirmationPromptEnabled) {
|
if (confirmationPromptEnabled) {
|
||||||
|
|||||||
Reference in New Issue
Block a user