summaryrefslogtreecommitdiff
path: root/runtime/native/java_lang_Class.cc
diff options
context:
space:
mode:
author Ian Rogers <irogers@google.com> 2014-07-21 16:37:48 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2014-07-19 23:20:08 +0000
commit719ca5ade262c5ace6a2ea32a3e4e48619d8439e (patch)
tree209973deaf02fdcccabc6e2c52a6db5df512aed9 /runtime/native/java_lang_Class.cc
parenta6d4bc19b0f68286862ce315377aaeb1e26a726b (diff)
parentc114b5fbc91e6d19ef430d9bc3468386ca61b324 (diff)
Merge "Fix erroneous behaviors with OOME present."
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) {