From e996a997216789a697daf87f929f9dcc86663e3e Mon Sep 17 00:00:00 2001 From: sakal Date: Tue, 10 Jan 2017 04:30:31 -0800 Subject: [PATCH] Add a check for CameraCapturer being initialized before calling startCapture. BUG=webrtc:6945 R=magjed@webrtc.org Review-Url: https://codereview.webrtc.org/2621633002 Cr-Commit-Position: refs/heads/master@{#15988} --- webrtc/sdk/android/api/org/webrtc/CameraCapturer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webrtc/sdk/android/api/org/webrtc/CameraCapturer.java b/webrtc/sdk/android/api/org/webrtc/CameraCapturer.java index 86f5f217c1..fcfcd70e86 100644 --- a/webrtc/sdk/android/api/org/webrtc/CameraCapturer.java +++ b/webrtc/sdk/android/api/org/webrtc/CameraCapturer.java @@ -13,7 +13,6 @@ package org.webrtc; import android.content.Context; import android.os.Handler; import android.os.Looper; - import java.util.Arrays; @SuppressWarnings("deprecation") @@ -258,6 +257,9 @@ public abstract class CameraCapturer implements CameraVideoCapturer { @Override public void startCapture(int width, int height, int framerate) { Logging.d(TAG, "startCapture: " + width + "x" + height + "@" + framerate); + if (applicationContext == null) { + throw new RuntimeException("CameraCapturer must be initialized before calling startCapture."); + } synchronized (stateLock) { if (sessionOpening || currentSession != null) {