db/simple: fix crash when mounting twice
The `db->close()` call was a `nullptr` dereference because the `db` variable had already been moved. Closes https://github.com/MusicPlayerDaemon/MPD/issues/839
This commit is contained in:
@@ -449,12 +449,7 @@ SimpleDatabase::Mount(const char *local_uri, const char *storage_uri)
|
||||
|
||||
// TODO: update the new database instance?
|
||||
|
||||
try {
|
||||
Mount(local_uri, std::move(db));
|
||||
} catch (...) {
|
||||
db->Close();
|
||||
throw;
|
||||
}
|
||||
Mount(local_uri, std::move(db));
|
||||
}
|
||||
|
||||
inline DatabasePtr
|
||||
|
Reference in New Issue
Block a user