Calls to array class methods (e.g. .clone()) would crash in cafebabe
because we're trying to search for a method, butthe array class doesn't
have a backing class file (i.e. cafebabe object).

Signed-off-by: Vegard Nossum <vegard.nos...@gmail.com>
---
 vm/class.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/vm/class.c b/vm/class.c
index 07fbdf5..ee22da8 100644
--- a/vm/class.c
+++ b/vm/class.c
@@ -559,6 +559,9 @@ int vm_class_resolve_field(const struct vm_class *vmc, 
uint16_t i,
 struct vm_field *vm_class_get_field(const struct vm_class *vmc,
        const char *name, const char *type)
 {
+       if (vmc->kind != VM_CLASS_KIND_REGULAR)
+               return NULL;
+
        unsigned int index = 0;
        if (!cafebabe_class_get_field(vmc->class, name, type, &index))
                return &vmc->fields[index];
@@ -661,6 +664,9 @@ int vm_class_resolve_method(const struct vm_class *vmc, 
uint16_t i,
 struct vm_method *vm_class_get_method(const struct vm_class *vmc,
        const char *name, const char *type)
 {
+       if (vmc->kind != VM_CLASS_KIND_REGULAR)
+               return NULL;
+
        unsigned int index = 0;
        if (!cafebabe_class_get_method(vmc->class, name, type, &index))
                return &vmc->methods[index];
-- 
1.6.0.4


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to