Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8eaad95d authored by Mark Harman's avatar Mark Harman
Browse files

Catch ArrayOutOfBoundsException from accessing list of cameras.

parent 1632bbc8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -41,6 +41,10 @@
<p>&lt; <small><a href="index.html">Main Page.</a></small></p>

<pre>
Version 1.43.2 (2018/04/13)

FIXED   Fixed some crashes.

Version 1.43.1 (2018/04/12)

FIXED   Crash when selecting antibanding setting on devices with no support for antibanding; this
+11 −0
Original line number Diff line number Diff line
@@ -1165,6 +1165,17 @@ public class CameraController2 extends CameraController {
			e.printStackTrace();
			throw new CameraControllerException();
		}
		catch(ArrayIndexOutOfBoundsException e) {
			// Have seen this from Google Play - even though the Preview should have checked the
			// cameraId is within the valid range! Although potentially this could happen if
			// getCameraIdList() returns an empty list.
			if( MyDebug.LOG ) {
				Log.e(TAG, "failed to open camera: ArrayIndexOutOfBoundsException");
				Log.e(TAG, "message: " + e.getMessage());
			}
			e.printStackTrace();
			throw new CameraControllerException();
		}

		// set up a timeout - sometimes if the camera has got in a state where it can't be opened until after a reboot, we'll never even get a myStateCallback callback called
		handler.postDelayed(new Runnable() {