diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-10-13 11:15:53 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-10-13 11:15:53 +0000 |
commit | e4af398681576d62df29cfee018dea800a7dfa17 (patch) | |
tree | ca2be74ec96cb78556d1ab57492a0ec20d03404a /src/libstore/db.cc | |
parent | 2a535689fe801441ef8e4a5c6659925528cce106 (diff) |
* Don't crash when upgrading the Berkeley DB environment.
Diffstat (limited to 'src/libstore/db.cc')
-rw-r--r-- | src/libstore/db.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libstore/db.cc b/src/libstore/db.cc index ca5d0582a..f378ef454 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; }; }; |