rem: if(value.s==NULL)
add: if(VAL_NULL(&(result->rows[0].values[1 + avps_int_n + i])) || value.s==NULL)
context: static inline int authorize(struct sip_msg* _m, str* _realm, char* _table, int _hftype){	char ha1[256];	int res, i;	struct hdr_field* h;	auth_body_t* cred;	auth_result_t ret;	str domain, value;	int_str iname, ivalue;	db_res_t* result;	str rpid;	domain = *_realm;	ret = pre_auth_func(_m, &domain, _hftype, &h);	switch(ret) {	case ERROR:            return 0;	case NOT_AUTHORIZED:   return -1;	case DO_AUTHORIZATION: break;	case AUTHORIZED:       return 1;	}	cred = (auth_body_t*)h->parsed;	res = get_ha1(&cred->digest.username, &domain, _table, ha1, &result);        if (res < 0) {		     /* Error while accessing the database */		if (sl_reply(_m, (char*)500, MESSAGE_500) == -1) {			LOG(L_ERR, "authorize(): Error while sending 500 reply\n");		}		return 0;	}	if (res > 0) {		     /* Username not found in the database */		auth_dbf.free_result(db_handle, result);		return -1;	}	     /* Recalculate response, it must be same to authorize successfully */        if (!check_response(&(cred->digest), &_m->first_line.u.request.method, ha1)) {		rpid.s = NULL;		rpid.len = 0;		for (i = 0; i < avps_str_n; i++) {			if (avps_str[i].len != 4 || memcmp(avps_str[i].s, "rpid", 4) != 0)				continue;			rpid.s = (char*)VAL_STRING(&(result->rows[0].values[1 + avps_int_n + i]));			if(rpid.s!=NULL)				rpid.len = strlen(rpid.s);		}		ret = post_auth_func(_m, h, &rpid);		switch(ret) {		case ERROR:			auth_dbf.free_result(db_handle, result);			return 0;		case NOT_AUTHORIZED:			auth_dbf.free_result(db_handle, result);			return -1;		case AUTHORIZED:			for (i = 0; i < avps_int_n; i++) {				iname.s = &(avps_int[i]);				ivalue.n = VAL_INT(&(result->rows[0].values[1 + i]));				add_avp(AVP_NAME_STR, iname, ivalue);				DBG("authorize(): set integer AVP \'%.*s = %d\'\n",				    iname.s->len, ZSW(iname.s->s), ivalue.n);			}			for (i = 0; i < avps_str_n; i++) {				value.s = (char*)VAL_STRING(&(result->rows[0].values[1 + avps_int_n + i]));				if(value.s==NULL)					continue;				iname.s = &(avps_str[i]);				value.len = strlen(value.s);				ivalue.s = &value;				add_avp(AVP_NAME_STR | AVP_VAL_STR, iname, ivalue);				DBG("authorize(): set string AVP \'%.*s = %.*s\'\n",				    iname.s->len, ZSW(iname.s->s), value.len, ZSW(value.s));			}			auth_dbf.free_result(db_handle, result);			return 1;		default:			auth_dbf.free_result(db_handle, result);			return -1;		}	}	auth_dbf.free_result(db_handle, result);	return -1;}