fix config_get, has no default.

This commit is contained in:
Enno Rehling 2017-11-10 16:32:20 +01:00
parent 6923fe5c53
commit 79b397e07f
1 changed files with 5 additions and 1 deletions

View File

@ -64,8 +64,12 @@ int db_save_order(order_data *od)
void db_open(void)
{
int err;
const char *dbname = config_get("config.dbname", "");
const char *dbname;
dbname = config_get("config.dbname");
if (!dbname) {
dbname = "";
}
err = sqlite3_open(dbname, &g_db);
assert(err == SQLITE_OK);
err = sqlite3_exec(g_db, "CREATE TABLE IF NOT EXISTS orders (id INTEGER PRIMARY KEY, data TEXT NOT NULL)", NULL, NULL, NULL);