From e4af398681576d62df29cfee018dea800a7dfa17 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 13 Oct 2006 11:15:53 +0000 Subject: * Don't crash when upgrading the Berkeley DB environment. --- src/libstore/db.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libstore/db.cc b/src/libstore/db.cc index ca5d0582a099..f378ef454947 100644 --- a/src/libstore/db.cc +++ b/src/libstore/db.cc @@ -30,7 +30,12 @@ class DestroyDbEnv DbEnv * dbenv; public: DestroyDbEnv(DbEnv * _dbenv) : dbenv(_dbenv) { } - ~DestroyDbEnv() { if (dbenv) { dbenv->close(0); delete dbenv; } } + ~DestroyDbEnv() { + if (dbenv) { + if (dbenv->get_DB_ENV()) dbenv->close(0); + delete dbenv; + } + } void release() { dbenv = 0; }; }; -- cgit 1.4.1