unix/modjni: new_jobject(): Handle null reference.
This commit is contained in:
parent
9d5e5c08ab
commit
7e18d3b6ff
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user