Check if ras->stmt is not null before writing it. That avoids
the risk of trying to write something if the database was not
opened.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
sqlite3 *db;
char sql[1024];
+ ras->stmt = NULL;
+
rc = sqlite3_initialize();
if (rc != SQLITE_OK) {
printf("Failed to initialize sqlite: error = %d\n", rc);
{
int rc;
+ if (!ras->stmt)
+ return;
+
sqlite3_bind_text(ras->stmt, 1, ev->timestamp, -1, NULL);
sqlite3_bind_int (ras->stmt, 2, ev->error_count);
sqlite3_bind_text(ras->stmt, 3, ev->error_type, -1, NULL);