diff --git a/webrtc/api/java/jni/jni_helpers.cc b/webrtc/api/java/jni/jni_helpers.cc index cd150142a1..32092e65f8 100644 --- a/webrtc/api/java/jni/jni_helpers.cc +++ b/webrtc/api/java/jni/jni_helpers.cc @@ -202,11 +202,8 @@ bool GetBooleanField(JNIEnv* jni, jobject object, jfieldID id) { return b; } -// Java references to "null" can only be distinguished as such in C++ by -// creating a local reference, so this helper wraps that logic. bool IsNull(JNIEnv* jni, jobject obj) { - ScopedLocalRefFrame local_ref_frame(jni); - return jni->NewLocalRef(obj) == NULL; + return jni->IsSameObject(obj, nullptr); } // Given a UTF-8 encoded |native| string return a new (UTF-16) jstring. diff --git a/webrtc/api/java/jni/jni_helpers.h b/webrtc/api/java/jni/jni_helpers.h index 05a956508c..87c5ca48f2 100644 --- a/webrtc/api/java/jni/jni_helpers.h +++ b/webrtc/api/java/jni/jni_helpers.h @@ -72,8 +72,7 @@ jint GetIntField(JNIEnv* jni, jobject object, jfieldID id); bool GetBooleanField(JNIEnv* jni, jobject object, jfieldID id); -// Java references to "null" can only be distinguished as such in C++ by -// creating a local reference, so this helper wraps that logic. +// Returns true if |obj| == null in Java. bool IsNull(JNIEnv* jni, jobject obj); // Given a UTF-8 encoded |native| string return a new (UTF-16) jstring.