Skip to content

Commit 7e18d3b

Browse files
committed
unix/modjni: new_jobject(): Handle null reference.
1 parent 9d5e5c0 commit 7e18d3b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

unix/modjni.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ STATIC const mp_obj_type_t jobject_type = {
217217
};
218218

219219
STATIC mp_obj_t new_jobject(jobject jo) {
220-
if (JJ(IsInstanceOf, jo, String_class)) {
220+
if (jo == NULL) {
221+
return mp_const_none;
222+
} else if (JJ(IsInstanceOf, jo, String_class)) {
221223
const char *s = JJ(GetStringUTFChars, jo, NULL);
222224
mp_obj_t ret = mp_obj_new_str(s, strlen(s), false);
223225
JJ(ReleaseStringUTFChars, jo, s);

0 commit comments

Comments
 (0)