From 08d4fddbb4728859ec2cc6d1d133bc91e5dd2733 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Sun, 17 Jul 2011 19:51:48 -0600 Subject: [PATCH] handle case of class with no methods in classInitializer --- src/machine.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/machine.cpp b/src/machine.cpp index 3fb1fb9ea1..a62fe7a7e6 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -3223,14 +3223,17 @@ instanceOf(Thread* t, object class_, object o) object classInitializer(Thread* t, object class_) { - for (unsigned i = 0; i < arrayLength(t, classMethodTable(t, class_)); ++i) { - object o = arrayBody(t, classMethodTable(t, class_), i); - - if (vm::strcmp(reinterpret_cast(""), - &byteArrayBody(t, methodName(t, o), 0)) == 0) + if (classMethodTable(t, class_)) { + for (unsigned i = 0; i < arrayLength(t, classMethodTable(t, class_)); ++i) { - return o; - } + object o = arrayBody(t, classMethodTable(t, class_), i); + + if (vm::strcmp(reinterpret_cast(""), + &byteArrayBody(t, methodName(t, o), 0)) == 0) + { + return o; + } + } } return 0; }