diff --git a/cdr/cdr_sqlite3_custom.c b/cdr/cdr_sqlite3_custom.c index a2027fe587..01ba2d797e 100644 --- a/cdr/cdr_sqlite3_custom.c +++ b/cdr/cdr_sqlite3_custom.c @@ -246,6 +246,11 @@ static int sqlite3_log(struct ast_cdr *cdr) struct ast_channel dummy = { 0, }; int count = 0; + if (db == NULL) { + /* Should not be loaded, but be failsafe. */ + return 0; + } + { /* Make it obvious that only sql should be used outside of this block */ char *escaped; char subst_buf[2048];