From a87630724ef4f8760684fa69c8ecc685735aff88 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Sat, 20 Dec 2014 00:08:35 -0800 Subject: ART: Do not JNI abort on nullptr GetObjectRefType A nullptr is a valid input, as it is different from a null reference. Bug: 18820997 Change-Id: Ibda8907ba13b20d2055049492a356ffdf4ddc714 --- runtime/jni_internal.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'runtime/jni_internal.cc') diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc index 4797e696d8..37ad46e209 100644 --- a/runtime/jni_internal.cc +++ b/runtime/jni_internal.cc @@ -2256,8 +2256,10 @@ class JNI { java_buffer, WellKnownClasses::java_nio_DirectByteBuffer_capacity)); } - static jobjectRefType GetObjectRefType(JNIEnv* env, jobject java_object) { - CHECK_NON_NULL_ARGUMENT_RETURN(java_object, JNIInvalidRefType); + static jobjectRefType GetObjectRefType(JNIEnv* env ATTRIBUTE_UNUSED, jobject java_object) { + if (java_object == nullptr) { + return JNIInvalidRefType; + } // Do we definitely know what kind of reference this is? IndirectRef ref = reinterpret_cast(java_object); @@ -2274,7 +2276,7 @@ class JNI { return JNILocalRefType; } LOG(FATAL) << "IndirectRefKind[" << kind << "]"; - return JNIInvalidRefType; + UNREACHABLE(); } private: -- cgit v1.2.3