db: small code cleanup

Changelog-None: db: small code cleanup

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
This commit is contained in:
Vincenzo Palazzo 2022-03-10 20:31:37 +01:00 committed by Rusty Russell
parent db95893aec
commit 6a146bed26

View File

@ -78,13 +78,9 @@ s64 db_get_intvar(struct db *db, char *varname, s64 defval)
struct db_stmt *stmt = db_prepare_v2(
db, SQL("SELECT intval FROM vars WHERE name= ? LIMIT 1"));
db_bind_text(stmt, 0, varname);
if (!db_query_prepared(stmt))
goto done;
if (db_step(stmt))
if (db_query_prepared(stmt) && db_step(stmt))
res = db_col_int(stmt, "intval");
done:
tal_free(stmt);
return res;
}