Run time illegal access checks on static and direct methods
Fixes test 075.
Change-Id: I28b20451dcae8000dc0e2cb9068dfa5166659d43
diff --git a/src/object.h b/src/object.h
index a7e012f..f9c8eb7 100644
--- a/src/object.h
+++ b/src/object.h
@@ -1016,7 +1016,12 @@
template<class T>
ObjectArray<T>* ObjectArray<T>::Alloc(Class* object_array_class, int32_t length) {
- return Array::Alloc(object_array_class, length, sizeof(uint32_t))->AsObjectArray<T>();
+ Array* array = Array::Alloc(object_array_class, length, sizeof(uint32_t));
+ if (UNLIKELY(array == NULL)) {
+ return NULL;
+ } else {
+ return array->AsObjectArray<T>();
+ }
}
template<class T>