diff options
author | James McCoy <jamessan@jamessan.com> | 2016-11-29 08:19:48 -0500 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2016-11-29 08:19:48 -0500 |
commit | b37d0624590feab84dada09526e041471b092acb (patch) | |
tree | 218970a6c0c77b72f15ccc88cd2f7072ed2a9c94 /src/nvim/msgpack_rpc/helpers.c | |
parent | 9e56278d0b2882657dc6614197e1cf6aad7bc08f (diff) | |
download | rneovim-b37d0624590feab84dada09526e041471b092acb.tar.gz rneovim-b37d0624590feab84dada09526e041471b092acb.tar.bz2 rneovim-b37d0624590feab84dada09526e041471b092acb.zip |
msgpack_rpc: Allocate empty string in msgpack_rpc_to_object
STR_CASE previously used a NULL data pointer for the String object, but
this pushes the NULL checks to the rest of the code. Instead,
allocating an empty string solves the same issue of there not being any
data but ensures that we're not passing NULL to functions that don't
expect it.
Closes #5627
Diffstat (limited to 'src/nvim/msgpack_rpc/helpers.c')
-rw-r--r-- | src/nvim/msgpack_rpc/helpers.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/msgpack_rpc/helpers.c b/src/nvim/msgpack_rpc/helpers.c index b0cfe2d6cd..5137b375f0 100644 --- a/src/nvim/msgpack_rpc/helpers.c +++ b/src/nvim/msgpack_rpc/helpers.c @@ -125,7 +125,7 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg) dest = conv(((String) { \ .size = obj->via.attr.size, \ .data = (obj->via.attr.ptr == NULL || obj->via.attr.size == 0 \ - ? NULL \ + ? xmemdupz("", 0) \ : xmemdupz(obj->via.attr.ptr, obj->via.attr.size)), \ })); \ break; \ |