Close database upon errors.
This commit is contained in:
parent
d2f30dcca7
commit
c31ccdece2
@ -118,6 +118,7 @@ int cmd_delete(int argc, char *argv[]) {
|
||||
|
||||
if(not db.recipe_exists(id)) {
|
||||
std::cerr << "No recipe exists with ID " << id << "." << std::endl;
|
||||
db.close();
|
||||
return EXIT_FAILURE;
|
||||
} else {
|
||||
recipe_ids.push_back(id);
|
||||
@ -139,6 +140,7 @@ int cmd_info(const int id) {
|
||||
|
||||
if(not db.recipe_exists(id)) {
|
||||
std::cerr << "No recipe with ID '" << id << "'";
|
||||
db.close();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user