diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-09-24 15:29:22 -0700 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-09-24 15:29:57 -0700 |
commit | 7e18d3b6ff54e422779362a65450a0ed7029f74d (patch) | |
tree | 873cd5a2490f4d1a2aec0f2f4a80cb849123cbf1 /unix/modjni.c | |
parent | 9d5e5c08ab1ee417251420a13573a951d3bf1ce8 (diff) | |
download | micropython-7e18d3b6ff54e422779362a65450a0ed7029f74d.tar.gz micropython-7e18d3b6ff54e422779362a65450a0ed7029f74d.zip |
unix/modjni: new_jobject(): Handle null reference.
Diffstat (limited to 'unix/modjni.c')
-rw-r--r-- | unix/modjni.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/unix/modjni.c b/unix/modjni.c index 498fc565b5..0eedd095ef 100644 --- a/unix/modjni.c +++ b/unix/modjni.c @@ -217,7 +217,9 @@ STATIC const mp_obj_type_t jobject_type = { }; STATIC mp_obj_t new_jobject(jobject jo) { - if (JJ(IsInstanceOf, jo, String_class)) { + if (jo == NULL) { + return mp_const_none; + } else if (JJ(IsInstanceOf, jo, String_class)) { const char *s = JJ(GetStringUTFChars, jo, NULL); mp_obj_t ret = mp_obj_new_str(s, strlen(s), false); JJ(ReleaseStringUTFChars, jo, s); |