unix/modffi.c: get_buffer is allowed to return NULL if len=0.

This is consistent with the logic in mp_get_buffer, and the code here is
an inlined version of that function.
This commit is contained in:
Damien George 2015-05-01 21:34:08 +01:00
parent a62c106974
commit a9afcb159a
1 changed files with 1 additions and 1 deletions

View File

@ -375,7 +375,7 @@ STATIC mp_obj_t ffifunc_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw,
mp_obj_base_t *o = (mp_obj_base_t*)a;
mp_buffer_info_t bufinfo;
int ret = o->type->buffer_p.get_buffer(o, &bufinfo, MP_BUFFER_READ); // TODO: MP_BUFFER_READ?
if (ret != 0 || bufinfo.buf == NULL) {
if (ret != 0) {
goto error;
}
values[i] = (ffi_arg)bufinfo.buf;