Fixed BytesRW() for zero-length array
When the length of an array is 0, we should return the address of the zero-length buffer instead of throwing a RangeOutOfBoundsException.
Change on 2017/08/02 by zgao
static inline char *BytesRW(id object) {
nil_chk(object);
if ([object isKindOfClass:[IOSByteArray class]]) {
- return (char *)IOSByteArray_GetRef(object, 0);
+ return (char *)((IOSByteArray *)object)->buffer_;
} else if ([object isKindOfClass:[JavaNioBuffer class]]) {
// All buffer concrete classes have byteBuffer at the same
// offset by explicit design.
