Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Unified Diff: webrtc/api/java/jni/jni_helpers.cc

Issue 1853523002: Allowing a Java object field to be null in a new JNI helper method. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Adding comment around maxBitrateBps explaining null value. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/api/java/jni/jni_helpers.cc
diff --git a/webrtc/api/java/jni/jni_helpers.cc b/webrtc/api/java/jni/jni_helpers.cc
index f42abc703e6ce613e47837a9107eff7eee78dd09..052dcf9a8960b255af8950a89d9434650328d8a4 100644
--- a/webrtc/api/java/jni/jni_helpers.cc
+++ b/webrtc/api/java/jni/jni_helpers.cc
@@ -176,7 +176,13 @@ jclass GetObjectClass(JNIEnv* jni, jobject object) {
jobject GetObjectField(JNIEnv* jni, jobject object, jfieldID id) {
jobject o = jni->GetObjectField(object, id);
CHECK_EXCEPTION(jni) << "error during GetObjectField";
pthatcher1 2016/04/11 19:39:29 Can't you replace this with GetNullableObjectField
Taylor Brandstetter 2016/04/11 23:13:38 True.
- RTC_CHECK(o) << "GetObjectField returned NULL";
+ RTC_CHECK(!IsNull(jni, o)) << "GetObjectField returned NULL";
+ return o;
+}
+
+jobject GetNullableObjectField(JNIEnv* jni, jobject object, jfieldID id) {
+ jobject o = jni->GetObjectField(object, id);
+ CHECK_EXCEPTION(jni) << "error during GetObjectField";
return o;
}

Powered by Google App Engine
This is Rietveld 408576698