Don't crash if createDataChannel fails.
It can fail in some real circumstances, such as when IDs are exhausted or you explicitly try to create one with an already-used ID. Review-Url: https://codereview.webrtc.org/2181933002 Cr-Commit-Position: refs/heads/master@{#13535}
This commit is contained in:
parent
1cd46643d7
commit
5f5504f218
@ -1726,7 +1726,10 @@ JOW(jobject, PeerConnection_createDataChannel)(
|
||||
// vararg parameter as 64-bit and reading memory that doesn't belong to the
|
||||
// 32-bit parameter.
|
||||
jlong nativeChannelPtr = jlongFromPointer(channel.get());
|
||||
RTC_CHECK(nativeChannelPtr) << "Failed to create DataChannel";
|
||||
if (!nativeChannelPtr) {
|
||||
LOG(LS_ERROR) << "Failed to create DataChannel";
|
||||
return nullptr;
|
||||
}
|
||||
jclass j_data_channel_class = FindClass(jni, "org/webrtc/DataChannel");
|
||||
jmethodID j_data_channel_ctor = GetMethodID(
|
||||
jni, j_data_channel_class, "<init>", "(J)V");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user