diff --git a/unix/modjni.c b/unix/modjni.c
index 808930fd33a4c9ee39f53760d830c961ad0049f0..eeed389ba2748876b87f73eb0bd43ec0a3f055d1 100644
--- a/unix/modjni.c
+++ b/unix/modjni.c
@@ -362,9 +362,19 @@ STATIC bool py2jvalue(const char **jtypesig, mp_obj_t arg, jvalue *out) {
         }
     } else if (type == &jobject_type) {
         printf("TODO: Check java arg type!!\n");
-        while (isalpha(*arg_type) || *arg_type == '.') {
+        bool is_object = false;
+        while (1) {
+            if (isalpha(*arg_type)) {
+            } else if (*arg_type == '.') {
+                is_object = true;
+            } else {
+                break;
+            }
             arg_type++;
         }
+        if (!is_object) {
+            return false;
+        }
         mp_obj_jobject_t *jo = arg;
         out->l = jo->obj;
     } else if (type == &mp_type_bool) {