catch NPE when detecting camera facing. fixes #3820
This commit is contained in:
parent
1107529f56
commit
bf85a55930
|
@ -509,7 +509,7 @@ public class WebRTCWrapper {
|
|||
final CameraEnumerator enumerator = getCameraEnumerator();
|
||||
final Set<String> deviceNames = ImmutableSet.copyOf(enumerator.getDeviceNames());
|
||||
for (final String deviceName : deviceNames) {
|
||||
if (enumerator.isFrontFacing(deviceName)) {
|
||||
if (isFrontFacing(enumerator, deviceName)) {
|
||||
final CapturerChoice capturerChoice = of(enumerator, deviceName, deviceNames);
|
||||
if (capturerChoice == null) {
|
||||
return Optional.absent();
|
||||
|
@ -525,6 +525,14 @@ public class WebRTCWrapper {
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean isFrontFacing(final CameraEnumerator cameraEnumerator, final String deviceName) {
|
||||
try {
|
||||
return cameraEnumerator.isFrontFacing(deviceName);
|
||||
} catch (final NullPointerException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public PeerConnection.PeerConnectionState getState() {
|
||||
return requirePeerConnection().connectionState();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue