summaryrefslogtreecommitdiffstats
path: root/src/librbd/api/Snapshot.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/librbd/api/Snapshot.cc')
-rw-r--r--src/librbd/api/Snapshot.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/librbd/api/Snapshot.cc b/src/librbd/api/Snapshot.cc
index 03cefbd1c..306ddb593 100644
--- a/src/librbd/api/Snapshot.cc
+++ b/src/librbd/api/Snapshot.cc
@@ -378,7 +378,9 @@ int Snapshot<I>::remove(I *ictx, const char *snap_name, uint32_t flags,
template <typename I>
int Snapshot<I>::get_timestamp(I *ictx, uint64_t snap_id, struct timespec *timestamp) {
auto snap_it = ictx->snap_info.find(snap_id);
- ceph_assert(snap_it != ictx->snap_info.end());
+ if (snap_it == ictx->snap_info.end()) {
+ return -ENOENT;
+ }
utime_t time = snap_it->second.timestamp;
time.to_timespec(timestamp);
return 0;