summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--unix/modjni.c4
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);