diff --git a/cli.cpp b/cli.cpp index 3a6023c..e3ec2b3 100644 --- a/cli.cpp +++ b/cli.cpp @@ -75,10 +75,7 @@ std::pair CLIHandler::user_change_pw([[maybe_unused]] const s userDao->save(*user); } - else - { - return {false, "User not found"}; - } + return {false, "User not found"}; } std::pair CLIHandler::user_rename([[maybe_unused]] const std::vector &args) diff --git a/database/categorydaosqlite.cpp b/database/categorydaosqlite.cpp index 2cbcaa0..cd9b047 100644 --- a/database/categorydaosqlite.cpp +++ b/database/categorydaosqlite.cpp @@ -42,6 +42,7 @@ std::optional CategoryDaoSqlite::find(std::string name) { throwFrom(e); } + return {}; } void CategoryDaoSqlite::save(const Category &c) diff --git a/database/sqlitedao.cpp b/database/sqlitedao.cpp index 9ec8771..b0f7a9a 100644 --- a/database/sqlitedao.cpp +++ b/database/sqlitedao.cpp @@ -22,18 +22,17 @@ SOFTWARE. bool SqliteDao::execBool(sqlite::database_binder &binder) const { - bool result; + bool result = false; try { - bool result; binder >> result; - return result; } catch(sqlite::sqlite_exception &e) { // TODO: well, we may want to check whether rows have found or not and thus log this here - return false; + result = false; } + return result; } int SqliteDao::execInt(sqlite::database_binder &binder) const @@ -52,4 +51,5 @@ int SqliteDao::execInt(sqlite::database_binder &binder) const { throwFrom(e); } + return 0; } diff --git a/database/userdaosqlite.cpp b/database/userdaosqlite.cpp index b6918a8..6e188f4 100644 --- a/database/userdaosqlite.cpp +++ b/database/userdaosqlite.cpp @@ -37,7 +37,6 @@ bool UserDaoSqlite::exists(std::string username) std::optional UserDaoSqlite::find(std::string username) { - try { User user; @@ -58,6 +57,7 @@ std::optional UserDaoSqlite::find(std::string username) { throwFrom(e); } + return {}; } std::optional UserDaoSqlite::find(int id) @@ -81,6 +81,7 @@ std::optional UserDaoSqlite::find(int id) { throwFrom(e); } + return {}; } std::vector UserDaoSqlite::list(QueryOption o)