*refactored to return unknown when trying to access a not exist key in a dictionary.

This commit is contained in:
Wang Renxin 2016-08-06 15:41:19 +08:00
parent 3400ec68c2
commit 5c668fa432
2 changed files with 11 additions and 2 deletions

View File

@ -1,4 +1,5 @@
Aug. 6 2016
Refactored to return UNKNOWN when trying to access a not exist key in a dictionary
Added reflection accessing ability to the SET statement
Aug. 4 2016

View File

@ -7245,8 +7245,16 @@ static bool_t _find_dict(_dict_t* coll, mb_value_t* val, mb_value_t* oval) {
_create_internal_object_from_public_value(val, &oarg);
result = _ht_find(coll->dict, oarg);
_destroy_object(oarg, 0);
if(oval && result && result->data)
_internal_object_to_public_value((_object_t*)result->data, oval);
if(oval) {
if(result && result->data) {
_internal_object_to_public_value((_object_t*)result->data, oval);
} else {
oval->type = MB_DT_UNKNOWN;
oval->value.integer = 0;
return true;
}
}
return !!(result && result->data);
}