Skip to content

Commit

Permalink
fix(android): return empty array rather than null for Ti.Media.availa…
Browse files Browse the repository at this point in the history
…bleCameras if no cameras
  • Loading branch information
sgtcoolguy committed Nov 2, 2020
1 parent c6ce7d6 commit 48006b6
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1403,14 +1403,13 @@ public boolean getIsCameraSupported()
public int[] getAvailableCameras()
{
int cameraCount = Camera.getNumberOfCameras();
int[] result = new int[cameraCount];

if (cameraCount == 0) {
return null;
return result;
}

int[] result = new int[cameraCount];

CameraInfo cameraInfo = new CameraInfo();

for (int i = 0; i < cameraCount; i++) {
Camera.getCameraInfo(i, cameraInfo);
switch (cameraInfo.facing) {
Expand Down

0 comments on commit 48006b6

Please sign in to comment.