rem: user.len    = strlen(user.s);
add: if (user.s==0){ LOG(L_CRIT, "preload_udomain: ERRROR: bad username " "record in table %s\n", b); LOG(L_CRIT, "preload_udomain: ERRROR: skipping...\n"); continue; }else{ user.len    = strlen(user.s); }
context: int preload_udomain(db_con_t* _c, udomain_t* _d){	char b[256];	db_key_t columns[10];	db_res_t* res;	db_row_t* row;	int i, cseq, rep, state;	unsigned int flags;	str user, contact, callid;	char* domain;	time_t expires;	qvalue_t q;	urecord_t* r;	ucontact_t* c;	columns[0] = user_col.s;	columns[1] = contact_col.s;	columns[2] = expires_col.s;	columns[3] = q_col.s;	columns[4] = callid_col.s;	columns[5] = cseq_col.s;	columns[6] = replicate_col.s;	columns[7] = state_col.s;	columns[8] = flags_col.s;	columns[9] = domain_col.s;		memcpy(b, _d->name->s, _d->name->len);	b[_d->name->len] = '\0';	if (ul_dbf.use_table(_c, b) < 0) {		LOG(L_ERR, "preload_udomain(): Error in use_table\n");		return -1;	}	if (ul_dbf.query(_c, 0, 0, 0, columns, 0, (use_domain) ? (10) : (9), 0,				&res) < 0) {		LOG(L_ERR, "preload_udomain(): Error while doing db_query\n");		return -1;	}	if (RES_ROW_N(res) == 0) {		DBG("preload_udomain(): Table is empty\n");		ul_dbf.free_query(_c, res);		return 0;	}	lock_udomain(_d);	for(i = 0; i < RES_ROW_N(res); i++) {		row = RES_ROWS(res) + i;				user.s      = (char*)VAL_STRING(ROW_VALUES(row));		user.len    = strlen(user.s);		contact.s   = (char*)VAL_STRING(ROW_VALUES(row) + 1);		contact.len = strlen(contact.s);		expires     = VAL_TIME  (ROW_VALUES(row) + 2);		q           = double2q(VAL_DOUBLE(ROW_VALUES(row) + 3));		cseq        = VAL_INT   (ROW_VALUES(row) + 5);		rep         = VAL_INT   (ROW_VALUES(row) + 6);		state       = VAL_INT   (ROW_VALUES(row) + 7);		callid.s    = (char*)VAL_STRING(ROW_VALUES(row) + 4);		callid.len  = strlen(callid.s);		flags       = VAL_BITMAP(ROW_VALUES(row) + 8);		if (use_domain) {			domain    = (char*)VAL_STRING(ROW_VALUES(row) + 9);			snprintf(b, 256, "%.*s@%s", user.len, ZSW(user.s), domain);			user.s = b;			user.len = strlen(b);		}		if (get_urecord(_d, &user, &r) > 0) {			if (mem_insert_urecord(_d, &user, &r) < 0) {				LOG(L_ERR, "preload_udomain(): Can't create a record\n");				ul_dbf.free_query(_c, res);				unlock_udomain(_d);				return -2;			}		}				if (mem_insert_ucontact(r, &contact, expires, q, &callid, cseq, flags, rep, &c) < 0) {			LOG(L_ERR, "preload_udomain(): Error while inserting contact\n");			ul_dbf.free_query(_c, res);			unlock_udomain(_d);			return -3;		}		     /* We have to do this, because insert_ucontact sets state to CS_NEW		      * and we have the contact in the database already			  * we also store zombies in database so we have to restore			  * the correct state		      */		if (state >= CS_ZOMBIE_N)			c->state = CS_ZOMBIE_S;		else			c->state = CS_SYNC;	}	ul_dbf.free_query(_c, res);	unlock_udomain(_d);	return 0;}