diff --git a/repertory/librepertory/include/database/db_common.hpp b/repertory/librepertory/include/database/db_common.hpp index 25fa3e1a..19dcb493 100644 --- a/repertory/librepertory/include/database/db_common.hpp +++ b/repertory/librepertory/include/database/db_common.hpp @@ -212,12 +212,13 @@ public: static_cast(__FUNCTION__); row.reset(); - if (has_row()) { - row = db_row{context_}; - set_res(sqlite3_step(context_->stmt.get()), function_name); - return true; + if (not has_row()) { + return false; } - return false; + + row = db_row{context_}; + set_res(sqlite3_step(context_->stmt.get()), function_name); + return true; } [[nodiscard]] auto has_row() const -> bool { return res_ == SQLITE_ROW; } @@ -232,4 +233,5 @@ public: } }; } // namespace repertory::db + #endif // INCLUDE_DATABASE_DB_COMMON_HPP_