Index: media/base/android/media_drm_bridge.cc |
diff --git a/media/base/android/media_drm_bridge.cc b/media/base/android/media_drm_bridge.cc |
index 7a9aab3aa5a7e40f4c6d6f7a8098a219890701f1..fcb446b28b21255ee0bea4dbccd99b5deb7ce6a4 100644 |
--- a/media/base/android/media_drm_bridge.cc |
+++ b/media/base/android/media_drm_bridge.cc |
@@ -326,9 +326,11 @@ void MediaDrmBridge::CreateSessionAndGenerateRequest( |
&optional_parameters_from_delegate)) { |
promise->reject(INVALID_ACCESS_ERROR, 0, "Invalid init data."); |
} |
- j_init_data = base::android::ToJavaByteArray( |
- env, vector_as_array(&init_data_from_delegate), |
- init_data_from_delegate.size()); |
+ if (!init_data_from_delegate.empty()) { |
+ j_init_data = base::android::ToJavaByteArray( |
+ env, vector_as_array(&init_data_from_delegate), |
+ init_data_from_delegate.size()); |
+ } |
if (!optional_parameters_from_delegate.empty()) { |
j_optional_parameters = base::android::ToJavaArrayOfStrings( |
env, optional_parameters_from_delegate); |