diff options
Diffstat (limited to 'src/objective-c/GRPCClient/private/NSData+GRPC.m')
-rw-r--r-- | src/objective-c/GRPCClient/private/NSData+GRPC.m | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/objective-c/GRPCClient/private/NSData+GRPC.m b/src/objective-c/GRPCClient/private/NSData+GRPC.m index 5ab16d9d34..6ea4ce979e 100644 --- a/src/objective-c/GRPCClient/private/NSData+GRPC.m +++ b/src/objective-c/GRPCClient/private/NSData+GRPC.m @@ -59,6 +59,9 @@ static grpc_byte_buffer *CopyCharArrayToNewByteBuffer(const char *array, size_t @implementation NSData (GRPC) + (instancetype)grpc_dataWithByteBuffer:(grpc_byte_buffer *)buffer { + if (buffer == NULL) { + return nil; + } NSUInteger length = grpc_byte_buffer_length(buffer); char *array = malloc(length * sizeof(*array)); if (!array) { |