Event e;
e.event_id = sqlite3_column_int(stmt, 0);
e.t = sqlite3_column_int(stmt, 1);
- e.player_id = sqlite3_column_int(stmt, 2);
+ if (sqlite3_column_type(stmt, 2) == SQLITE_INTEGER) { // Non-NULL.
+ e.player_id = sqlite3_column_int(stmt, 2);
+ }
e.type = (const char *)sqlite3_column_text(stmt, 3);
events.push_back(std::move(e));
} else if (ret == SQLITE_DONE) {