diff --git a/src/eckit/io/PooledFile.cc b/src/eckit/io/PooledFile.cc index 2de01763d..2eab33485 100644 --- a/src/eckit/io/PooledFile.cc +++ b/src/eckit/io/PooledFile.cc @@ -73,10 +73,9 @@ class PoolFileEntry { void remove(const PooledFile* file) { auto s = statuses_.find(file); - ASSERT(s != statuses_.end()); - - statuses_.erase(s); - + if (s != statuses_.end()) { + statuses_.erase(s); + } if (statuses_.size() == 0) { doClose(); pool_.erase(name_); @@ -114,10 +113,10 @@ class PoolFileEntry { void close(const PooledFile* file) { auto s = statuses_.find(file); - ASSERT(s != statuses_.end()); - - ASSERT(s->second.opened_); - s->second.opened_ = false; + if (s != statuses_.end()) { + ASSERT(s->second.opened_); + s->second.opened_ = false; + } } int fileno(const PooledFile* file) const {