modffi: 's' (string) return type: handle NULL properly (return None).

This commit is contained in:
Paul Sokolovsky 2015-01-25 00:42:39 +02:00
parent 32444b759a
commit 31c1f1300e

View File

@ -140,6 +140,9 @@ STATIC mp_obj_t return_ffi_value(ffi_arg val, char type)
switch (type) { switch (type) {
case 's': { case 's': {
const char *s = (const char *)val; const char *s = (const char *)val;
if (!s) {
return mp_const_none;
}
return mp_obj_new_str(s, strlen(s), false); return mp_obj_new_str(s, strlen(s), false);
} }
case 'v': case 'v':