Check for null thread groups at initialization
Change-Id: Ia6fffe9f416ac4bd2588016b99b172cf023f3c5d
diff --git a/src/runtime.cc b/src/runtime.cc
index ae4f16e..6447ede 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -770,9 +770,21 @@
main_thread_group_ =
env->NewGlobalRef(env->GetStaticObjectField(WellKnownClasses::java_lang_ThreadGroup,
WellKnownClasses::java_lang_ThreadGroup_mainThreadGroup));
+ CHECK(main_thread_group_ != NULL || IsCompiler());
system_thread_group_ =
env->NewGlobalRef(env->GetStaticObjectField(WellKnownClasses::java_lang_ThreadGroup,
WellKnownClasses::java_lang_ThreadGroup_systemThreadGroup));
+ CHECK(system_thread_group_ != NULL || IsCompiler());
+}
+
+jobject Runtime::GetMainThreadGroup() const {
+ CHECK(main_thread_group_ != NULL || IsCompiler());
+ return main_thread_group_;
+}
+
+jobject Runtime::GetSystemThreadGroup() const {
+ CHECK(system_thread_group_ != NULL || IsCompiler());
+ return system_thread_group_;
}
void Runtime::RegisterRuntimeNativeMethods(JNIEnv* env) {