Skip to content

Commit

Permalink
Merge pull request #220 from mslehto/htable
Browse files Browse the repository at this point in the history
modules/htable: improves error message when loading from database
  • Loading branch information
miconda committed Jun 25, 2015
2 parents 37e205c + f39736b commit afbcbfb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions modules/htable/ht_db.c
Expand Up @@ -197,11 +197,17 @@ int ht_db_load_table(ht_t *ht, str *dbtable, int mode)
do {
for(i=0; i<RES_ROW_N(db_res); i++)
{
if(RES_ROWS(db_res)[i].values[0].type!=DB1_STRING
|| VAL_NULL(&RES_ROWS(db_res)[i].values[0])) {
LM_ERR("key type must be string and its value not null\n");
if(VAL_NULL(&RES_ROWS(db_res)[i].values[0])) {
LM_ERR("key value must not be null\n");
goto error;
}

if(RES_ROWS(db_res)[i].values[0].type!=DB1_STRING) {
LM_ERR("key type must be string (type=%d)\n",
RES_ROWS(db_res)[i].values[0].type);
goto error;
}

kname.s = (char*)(RES_ROWS(db_res)[i].values[0].val.string_val);
if(kname.s==NULL) {
LM_ERR("null key in row %d\n", i);
Expand Down

0 comments on commit afbcbfb

Please sign in to comment.