Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (14321 => 14322)
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c 2009-07-22 19:35:11 UTC (rev 14321)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c 2009-07-22 20:37:20 UTC (rev 14322)
@@ -4016,11 +4016,16 @@
while (running < 5000) {
int result = switch_core_db_step(stmt);
+ const unsigned char *txt;
if (result == SWITCH_CORE_DB_ROW) {
- if ((colcount = switch_core_db_column_count(stmt))) {
- switch_copy_string(resbuf, (char *) switch_core_db_column_text(stmt, 0), len);
- ret = resbuf;
+ if ((colcount = switch_core_db_column_count(stmt)) > 0) {
+ if ((txt = switch_core_db_column_text(stmt, 0))) {
+ switch_copy_string(resbuf, (char *) txt, len);
+ ret = resbuf;
+ } else {
+ goto fail;
+ }
}
break;
} else if (result == SWITCH_CORE_DB_BUSY) {
Modified: freeswitch/trunk/src/switch_core_db.c (14321 => 14322)
--- freeswitch/trunk/src/switch_core_db.c 2009-07-22 19:35:11 UTC (rev 14321)
+++ freeswitch/trunk/src/switch_core_db.c 2009-07-22 20:37:20 UTC (rev 14322)
@@ -57,7 +57,14 @@
SWITCH_DECLARE(const unsigned char *) switch_core_db_column_text(switch_core_db_stmt_t *stmt, int iCol)
{
- return sqlite3_column_text(stmt, iCol);
+ const unsigned char *txt = sqlite3_column_text(stmt, iCol);
+
+ if (txt && !strcasecmp((char *)txt, "(null)")) {
+ txt = NULL;
+ }
+
+ return txt;
+
}
SWITCH_DECLARE(const char *) switch_core_db_column_name(switch_core_db_stmt_t *stmt, int N)