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
1 changed files with 3 additions and 0 deletions

View File

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