unix/modjni: new_jobject(): Handle null reference.

This commit is contained in:
Paul Sokolovsky 2015-09-24 15:29:22 -07:00
parent 9d5e5c08ab
commit 7e18d3b6ff
1 changed files with 3 additions and 1 deletions

View File

@ -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);