summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-10-22 01:34:03 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-10-22 01:35:17 +0300
commit9ebd4dabf20e577c8819c92edd20b30105dd957c (patch)
treec6d2af39c70941027b141984783eb94300a9d98d
parent9273cca43265f7b74a496cae92510e8e13bab3fb (diff)
unix/modjni: Don't pass Java object to a method which doesn't expect it.
For example, don't pass Integer to double method. This is still not selective enough to choose the right overloaded method maong those taking objects.
-rw-r--r--unix/modjni.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/unix/modjni.c b/unix/modjni.c
index 808930fd3..eeed389ba 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) {