summaryrefslogtreecommitdiff
path: root/runtime/native/java_lang_Class.cc
diff options
context:
space:
mode:
author Ian Rogers <irogers@google.com> 2014-07-21 08:55:01 -0700
committer Ian Rogers <irogers@google.com> 2014-07-21 08:55:01 -0700
commitc114b5fbc91e6d19ef430d9bc3468386ca61b324 (patch)
tree209973deaf02fdcccabc6e2c52a6db5df512aed9 /runtime/native/java_lang_Class.cc
parenta6d4bc19b0f68286862ce315377aaeb1e26a726b (diff)
Fix erroneous behaviors with OOME present.
Bug: 16454510 Change-Id: I757088a7b82ff73f58aba8d357080028b56442e6
Diffstat (limited to 'runtime/native/java_lang_Class.cc')
-rw-r--r--runtime/native/java_lang_Class.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc
index e577c2c960..124bdf5475 100644
--- a/runtime/native/java_lang_Class.cc
+++ b/runtime/native/java_lang_Class.cc
@@ -71,7 +71,10 @@ static jclass Class_classForName(JNIEnv* env, jclass, jstring javaName, jboolean
jthrowable cnfe = reinterpret_cast<jthrowable>(env->NewObject(WellKnownClasses::java_lang_ClassNotFoundException,
WellKnownClasses::java_lang_ClassNotFoundException_init,
javaName, cause.get()));
- env->Throw(cnfe);
+ if (cnfe != nullptr) {
+ // Make sure allocation didn't fail with an OOME.
+ env->Throw(cnfe);
+ }
return nullptr;
}
if (initialize) {