Skip to content

Commit

Permalink
mi: add empty string with add_mi_string() if value is null
Browse files Browse the repository at this point in the history
  • Loading branch information
rvlad-patrascu committed Feb 5, 2019
1 parent 003108a commit 08fc04f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mi/item.c
Expand Up @@ -208,7 +208,10 @@ static mi_item_t *_add_mi_item(mi_item_t *to, char *name, int name_len,
item = cJSON_CreateObject();
break;
case cJSON_String:
item = cJSON_CreateStr(sval, sval_len);
if (!sval || sval_len == 0)
item = cJSON_CreateStr("", 0);
else
item = cJSON_CreateStr(sval, sval_len);
break;
case cJSON_Number:
item = cJSON_CreateNumber(dval);
Expand Down

0 comments on commit 08fc04f

Please sign in to comment.