diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-01-25 00:42:39 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-01-25 01:36:14 +0200 |
commit | 31c1f1300e2f166061cb0a491fab30ac37018a94 (patch) | |
tree | b8feaa75ef75b69998dcad121ee09056d51f8243 /unix/modffi.c | |
parent | 32444b759a1b4f339908f65ee8f50a21eee7d16c (diff) | |
download | micropython-31c1f1300e2f166061cb0a491fab30ac37018a94.tar.gz micropython-31c1f1300e2f166061cb0a491fab30ac37018a94.zip |
modffi: 's' (string) return type: handle NULL properly (return None).
Diffstat (limited to 'unix/modffi.c')
-rw-r--r-- | unix/modffi.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/unix/modffi.c b/unix/modffi.c index 7c87e5b01a..6e0f06ec77 100644 --- a/unix/modffi.c +++ b/unix/modffi.c @@ -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': |